Skip to content

Commit 403d983

Browse files
committed
【fix】服务相关类增加网络异常捕获 review by songym
1 parent 4c4e7ee commit 403d983

18 files changed

+274
-329
lines changed

dist/classic/iclient-classic-es6.js

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,19 @@
4444
/******/ // define getter function for harmony exports
4545
/******/ __webpack_require__.d = function(exports, name, getter) {
4646
/******/ if(!__webpack_require__.o(exports, name)) {
47-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
47+
/******/ Object.defineProperty(exports, name, {
48+
/******/ configurable: false,
49+
/******/ enumerable: true,
50+
/******/ get: getter
51+
/******/ });
4852
/******/ }
4953
/******/ };
5054
/******/
5155
/******/ // define __esModule on exports
5256
/******/ __webpack_require__.r = function(exports) {
53-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
54-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
55-
/******/ }
5657
/******/ Object.defineProperty(exports, '__esModule', { value: true });
5758
/******/ };
5859
/******/
59-
/******/ // create a fake namespace object
60-
/******/ // mode & 1: value is a module id, require it
61-
/******/ // mode & 2: merge all properties of value into the ns
62-
/******/ // mode & 4: return value when already ns object
63-
/******/ // mode & 8|1: behave like require
64-
/******/ __webpack_require__.t = function(value, mode) {
65-
/******/ if(mode & 1) value = __webpack_require__(value);
66-
/******/ if(mode & 8) return value;
67-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
68-
/******/ var ns = Object.create(null);
69-
/******/ __webpack_require__.r(ns);
70-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
71-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
72-
/******/ return ns;
73-
/******/ };
74-
/******/
7560
/******/ // getDefaultExport function for compatibility with non-harmony modules
7661
/******/ __webpack_require__.n = function(module) {
7762
/******/ var getter = module && module.__esModule ?
@@ -8436,7 +8421,7 @@ SuperMap.Format.JSON = JSON_JSONFormat;
84368421
* @category iServer
84378422
* @classdesc 对接 iServer 各种服务的 Service 的基类。
84388423
* @param {string} url - 服务地址。
8439-
* @param {Object} options - 参数。
8424+
* @param {Object} options - 参数。
84408425
* @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
84418426
* @param {string} [options.proxy] - 服务代理地址。
84428427
* @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
@@ -8547,15 +8532,15 @@ class CommonServiceBase_CommonServiceBase {
85478532
* @function SuperMap.CommonServiceBase.prototype.request
85488533
* @description: 该方法用于向服务发送请求。
85498534
* @param {Object} options - 参数。
8550-
* @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
8551-
* @param {string} [options.url] - 发送请求的地址。
8552-
* @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
8553-
* @param {string} [options.data] - 发送到服务器的数据。
8554-
* @param {function} options.success - 请求成功后的回调函数。
8555-
* @param {function} options.failure - 请求失败后的回调函数。
8556-
* @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
8557-
* @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
8558-
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
8535+
* @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
8536+
* @param {string} [options.url] - 发送请求的地址。
8537+
* @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
8538+
* @param {string} [options.data] - 发送到服务器的数据。
8539+
* @param {function} options.success - 请求成功后的回调函数。
8540+
* @param {function} options.failure - 请求失败后的回调函数。
8541+
* @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
8542+
* @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
8543+
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
85598544
*/
85608545
request(options) {
85618546
let me = this;
@@ -8774,7 +8759,9 @@ class CommonServiceBase_CommonServiceBase {
87748759
var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
87758760
success(result);
87768761
}
8777-
8762+
}).catch(function (e) {
8763+
var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
8764+
failure(e);
87788765
})
87798766
}
87808767
}

dist/classic/iclient-classic-es6.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/classic/iclient-classic.js

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,19 @@
4444
/******/ // define getter function for harmony exports
4545
/******/ __webpack_require__.d = function(exports, name, getter) {
4646
/******/ if(!__webpack_require__.o(exports, name)) {
47-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
47+
/******/ Object.defineProperty(exports, name, {
48+
/******/ configurable: false,
49+
/******/ enumerable: true,
50+
/******/ get: getter
51+
/******/ });
4852
/******/ }
4953
/******/ };
5054
/******/
5155
/******/ // define __esModule on exports
5256
/******/ __webpack_require__.r = function(exports) {
53-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
54-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
55-
/******/ }
5657
/******/ Object.defineProperty(exports, '__esModule', { value: true });
5758
/******/ };
5859
/******/
59-
/******/ // create a fake namespace object
60-
/******/ // mode & 1: value is a module id, require it
61-
/******/ // mode & 2: merge all properties of value into the ns
62-
/******/ // mode & 4: return value when already ns object
63-
/******/ // mode & 8|1: behave like require
64-
/******/ __webpack_require__.t = function(value, mode) {
65-
/******/ if(mode & 1) value = __webpack_require__(value);
66-
/******/ if(mode & 8) return value;
67-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
68-
/******/ var ns = Object.create(null);
69-
/******/ __webpack_require__.r(ns);
70-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
71-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
72-
/******/ return ns;
73-
/******/ };
74-
/******/
7560
/******/ // getDefaultExport function for compatibility with non-harmony modules
7661
/******/ __webpack_require__.n = function(module) {
7762
/******/ var getter = module && module.__esModule ?
@@ -2896,7 +2881,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
28962881
* @category iServer
28972882
* @classdesc 对接 iServer 各种服务的 Service 的基类。
28982883
* @param {string} url - 服务地址。
2899-
* @param {Object} options - 参数。
2884+
* @param {Object} options - 参数。
29002885
* @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
29012886
* @param {string} [options.proxy] - 服务代理地址。
29022887
* @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
@@ -3012,15 +2997,15 @@ var CommonServiceBase = exports.CommonServiceBase = function () {
30122997
* @function SuperMap.CommonServiceBase.prototype.request
30132998
* @description: 该方法用于向服务发送请求。
30142999
* @param {Object} options - 参数。
3015-
* @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
3016-
* @param {string} [options.url] - 发送请求的地址。
3017-
* @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
3018-
* @param {string} [options.data] - 发送到服务器的数据。
3019-
* @param {function} options.success - 请求成功后的回调函数。
3020-
* @param {function} options.failure - 请求失败后的回调函数。
3021-
* @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
3022-
* @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
3023-
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
3000+
* @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
3001+
* @param {string} [options.url] - 发送请求的地址。
3002+
* @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
3003+
* @param {string} [options.data] - 发送到服务器的数据。
3004+
* @param {function} options.success - 请求成功后的回调函数。
3005+
* @param {function} options.failure - 请求失败后的回调函数。
3006+
* @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
3007+
* @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
3008+
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
30243009
*/
30253010

30263011
}, {
@@ -3260,6 +3245,9 @@ var CommonServiceBase = exports.CommonServiceBase = function () {
32603245
var success = options.scope ? _BaseTypes.FunctionExt.bind(options.success, options.scope) : options.success;
32613246
success(result);
32623247
}
3248+
}).catch(function (e) {
3249+
var failure = options.scope ? _BaseTypes.FunctionExt.bind(options.failure, options.scope) : options.failure;
3250+
failure(e);
32633251
});
32643252
}
32653253
}]);

dist/classic/iclient-classic.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/leaflet/iclient9-leaflet-es6.js

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,19 @@
4444
/******/ // define getter function for harmony exports
4545
/******/ __webpack_require__.d = function(exports, name, getter) {
4646
/******/ if(!__webpack_require__.o(exports, name)) {
47-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
47+
/******/ Object.defineProperty(exports, name, {
48+
/******/ configurable: false,
49+
/******/ enumerable: true,
50+
/******/ get: getter
51+
/******/ });
4852
/******/ }
4953
/******/ };
5054
/******/
5155
/******/ // define __esModule on exports
5256
/******/ __webpack_require__.r = function(exports) {
53-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
54-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
55-
/******/ }
5657
/******/ Object.defineProperty(exports, '__esModule', { value: true });
5758
/******/ };
5859
/******/
59-
/******/ // create a fake namespace object
60-
/******/ // mode & 1: value is a module id, require it
61-
/******/ // mode & 2: merge all properties of value into the ns
62-
/******/ // mode & 4: return value when already ns object
63-
/******/ // mode & 8|1: behave like require
64-
/******/ __webpack_require__.t = function(value, mode) {
65-
/******/ if(mode & 1) value = __webpack_require__(value);
66-
/******/ if(mode & 8) return value;
67-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
68-
/******/ var ns = Object.create(null);
69-
/******/ __webpack_require__.r(ns);
70-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
71-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
72-
/******/ return ns;
73-
/******/ };
74-
/******/
7560
/******/ // getDefaultExport function for compatibility with non-harmony modules
7661
/******/ __webpack_require__.n = function(module) {
7762
/******/ var getter = module && module.__esModule ?
@@ -16231,7 +16216,7 @@ SuperMap.iPortal = iPortal_IPortal;
1623116216
* @category iServer
1623216217
* @classdesc 对接 iServer 各种服务的 Service 的基类。
1623316218
* @param {string} url - 服务地址。
16234-
* @param {Object} options - 参数。
16219+
* @param {Object} options - 参数。
1623516220
* @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
1623616221
* @param {string} [options.proxy] - 服务代理地址。
1623716222
* @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
@@ -16342,15 +16327,15 @@ class CommonServiceBase_CommonServiceBase {
1634216327
* @function SuperMap.CommonServiceBase.prototype.request
1634316328
* @description: 该方法用于向服务发送请求。
1634416329
* @param {Object} options - 参数。
16345-
* @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
16346-
* @param {string} [options.url] - 发送请求的地址。
16347-
* @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
16348-
* @param {string} [options.data] - 发送到服务器的数据。
16349-
* @param {function} options.success - 请求成功后的回调函数。
16350-
* @param {function} options.failure - 请求失败后的回调函数。
16351-
* @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
16352-
* @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
16353-
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
16330+
* @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
16331+
* @param {string} [options.url] - 发送请求的地址。
16332+
* @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
16333+
* @param {string} [options.data] - 发送到服务器的数据。
16334+
* @param {function} options.success - 请求成功后的回调函数。
16335+
* @param {function} options.failure - 请求失败后的回调函数。
16336+
* @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
16337+
* @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
16338+
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
1635416339
*/
1635516340
request(options) {
1635616341
let me = this;
@@ -16569,7 +16554,9 @@ class CommonServiceBase_CommonServiceBase {
1656916554
var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
1657016555
success(result);
1657116556
}
16572-
16557+
}).catch(function (e) {
16558+
var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
16559+
failure(e);
1657316560
})
1657416561
}
1657516562
}
@@ -91654,7 +91641,7 @@ module.exports = function(proj4){
9165491641
/* 74 */
9165591642
/***/ (function(module) {
9165691643

91657-
module.exports = {"_args":[["proj4@2.3.15","D:\\iClient-JavaScript"]],"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"http://registry.npm.taobao.org/proj4/download/proj4-2.3.15.tgz","_spec":"2.3.15","_where":"D:\\iClient-JavaScript","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"~0.0.2"},"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"};
91644+
module.exports = {"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"http://registry.npm.taobao.org/proj4/download/proj4-2.3.15.tgz","_shasum":"5ad06e8bca30be0ffa389a49e4565f51f06d089e","_spec":"proj4@2.3.15","_where":"F:\\dev\\iClient-JavaScript","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"bundleDependencies":false,"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"~0.0.2"},"deprecated":false,"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"};
9165891645

9165991646
/***/ }),
9166091647
/* 75 */

dist/leaflet/iclient9-leaflet-es6.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy