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

Commit 33d0d8d

Browse files
JiaLiPassionmhevery
authored andcommitted
fix(minification): fix #607 to change catch variable name to error/err (#609)
1 parent 787b636 commit 33d0d8d

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

Diff for: lib/browser/define-property.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function rewriteDescriptor(obj, prop, desc) {
7979
function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {
8080
try {
8181
return _defineProperty(obj, prop, desc);
82-
} catch (e) {
82+
} catch (error) {
8383
if (desc.configurable) {
8484
// In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's
8585
// retry with the original flag value
@@ -90,18 +90,18 @@ function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {
9090
}
9191
try {
9292
return _defineProperty(obj, prop, desc);
93-
} catch (e) {
93+
} catch (error) {
9494
let descJson: string = null;
9595
try {
9696
descJson = JSON.stringify(desc);
97-
} catch (e) {
97+
} catch (error) {
9898
descJson = descJson.toString();
9999
}
100100
console.log(`Attempting to configure '${prop}' with descriptor '${descJson
101-
}' on object '${obj}' and got error, giving up: ${e}`);
101+
}' on object '${obj}' and got error, giving up: ${error}`);
102102
}
103103
} else {
104-
throw e;
104+
throw error;
105105
}
106106
}
107107
}

Diff for: lib/common/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export function makeZoneAwareAddListener(
277277
// accessing the handler object here will cause an exception to be thrown which
278278
// will fail tests prematurely.
279279
validZoneHandler = data.handler && data.handler.toString() === '[object FunctionWrapper]';
280-
} catch (e) {
280+
} catch (error) {
281281
// Returning nothing here is fine, because objects in a cross-site context are unusable
282282
return;
283283
}
@@ -454,7 +454,7 @@ export function patchClass(className) {
454454
export function createNamedFn(name: string, delegate: (self: any, args: any[]) => any): Function {
455455
try {
456456
return (Function('f', `return function ${name}(){return f(this, arguments)}`))(delegate);
457-
} catch (e) {
457+
} catch (error) {
458458
// if we fail, we must be CSP, just return delegate.
459459
return function() {
460460
return delegate(this, <any>arguments);

Diff for: lib/zone-spec/long-stack-trace.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function getStacktraceWithUncaughtError(): Error {
2323
function getStacktraceWithCaughtError(): Error {
2424
try {
2525
throw getStacktraceWithUncaughtError();
26-
} catch (e) {
27-
return e;
26+
} catch (error) {
27+
return error;
2828
}
2929
}
3030

@@ -107,21 +107,21 @@ Zone['longStackTraceZoneSpec'] = <ZoneSpec>{
107107
Object.defineProperty(error, 'stack', descriptor);
108108
stackSetSucceeded = true;
109109
}
110-
} catch (e) {
110+
} catch (err) {
111111
}
112112
const longStack: string = stackSetSucceeded ?
113113
null :
114114
renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], error.stack);
115115
if (!stackSetSucceeded) {
116116
try {
117117
stackSetSucceeded = error.stack = longStack;
118-
} catch (e) {
118+
} catch (err) {
119119
}
120120
}
121121
if (!stackSetSucceeded) {
122122
try {
123123
stackSetSucceeded = (error as any).longStack = longStack;
124-
} catch (e) {
124+
} catch (err) {
125125
}
126126
}
127127
}

Diff for: lib/zone.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,8 @@ const Zone: ZoneType = (function(global: any) {
10501050
const task = queue[i];
10511051
try {
10521052
task.zone.runTask(task, null, null);
1053-
} catch (e) {
1054-
consoleError(e);
1053+
} catch (error) {
1054+
consoleError(error);
10551055
}
10561056
}
10571057
}
@@ -1062,8 +1062,8 @@ const Zone: ZoneType = (function(global: any) {
10621062
uncaughtPromiseError.zone.runGuarded(() => {
10631063
throw uncaughtPromiseError;
10641064
});
1065-
} catch (e) {
1066-
consoleError(e);
1065+
} catch (error) {
1066+
consoleError(error);
10671067
}
10681068
}
10691069
}
@@ -1122,8 +1122,8 @@ const Zone: ZoneType = (function(global: any) {
11221122
throw new Error(
11231123
'Uncaught (in promise): ' + value +
11241124
(value && value.stack ? '\n' + value.stack : ''));
1125-
} catch (e) {
1126-
const error: UncaughtPromiseError = e;
1125+
} catch (err) {
1126+
const error: UncaughtPromiseError = err;
11271127
error.rejection = value;
11281128
error.promise = promise;
11291129
error.zone = Zone.current;
@@ -1240,8 +1240,8 @@ const Zone: ZoneType = (function(global: any) {
12401240
promise[symbolValue] = []; // queue;
12411241
try {
12421242
executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
1243-
} catch (e) {
1244-
resolvePromise(promise, false, e);
1243+
} catch (error) {
1244+
resolvePromise(promise, false, error);
12451245
}
12461246
}
12471247

@@ -1291,7 +1291,7 @@ const Zone: ZoneType = (function(global: any) {
12911291
try {
12921292
// In MS Edge this throws
12931293
fetchPromise = global['fetch']();
1294-
} catch (e) {
1294+
} catch (error) {
12951295
// In Chrome this throws instead.
12961296
fetchPromise = global['fetch']('about:blank');
12971297
}

0 commit comments

Comments
 (0)