Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 1fe4df0

Browse files
committedSep 2, 2016
fix: provide a more usefull error when configuring properties
1 parent 671a0a1 commit 1fe4df0

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed
 

‎lib/browser/browser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function patchXHR(window: any) {
8484
var openNative = patchMethod(window.XMLHttpRequest.prototype, 'open', () => function(self: any, args: any[]) {
8585
self[XHR_SYNC] = args[2] == false;
8686
return openNative.apply(self, args);
87-
};
87+
});
8888

8989
var sendNative = patchMethod(window.XMLHttpRequest.prototype, 'send', () => function(self: any, args: any[]) {
9090
var zone = Zone.current;

‎lib/browser/define-property.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ function _tryDefineProperty (obj, prop, desc, originalConfigurableFlag) {
7979
} else {
8080
desc.configurable = originalConfigurableFlag;
8181
}
82-
return _defineProperty(obj, prop, desc);
82+
try {
83+
return _defineProperty(obj, prop, desc);
84+
} catch (e) {
85+
var descJson: string = null;
86+
try { descJson = JSON.stringify(desc); } catch (e) { descJson = descJson.toString(); }
87+
console.log(`Attempting to configure '${prop}' with descriptor '${descJson}' on object '${obj}' and got error, giving up: ${e}`);
88+
}
8389
} else {
8490
throw e;
8591
}

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"es6-promise": "^3.0.2",
3838
"gulp": "^3.8.11",
3939
"gulp-rename": "^1.2.2",
40+
"gulp-rollup": "^2.3.0",
4041
"gulp-tsc": "^1.1.4",
4142
"gulp-uglify": "^1.2.0",
4243
"gulp-util": "^3.0.7",

0 commit comments

Comments
 (0)
This repository has been archived.