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

Commit

Permalink
fix(minification): fix #607 to change catch variable name to error/err (
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion authored and mhevery committed Jan 23, 2017
1 parent 787b636 commit 33d0d8d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions lib/browser/define-property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function rewriteDescriptor(obj, prop, desc) {
function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {
try {
return _defineProperty(obj, prop, desc);
} catch (e) {
} catch (error) {
if (desc.configurable) {
// In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's
// retry with the original flag value
Expand All @@ -90,18 +90,18 @@ function _tryDefineProperty(obj, prop, desc, originalConfigurableFlag) {
}
try {
return _defineProperty(obj, prop, desc);
} catch (e) {
} catch (error) {
let descJson: string = null;
try {
descJson = JSON.stringify(desc);
} catch (e) {
} catch (error) {
descJson = descJson.toString();
}
console.log(`Attempting to configure '${prop}' with descriptor '${descJson
}' on object '${obj}' and got error, giving up: ${e}`);
}' on object '${obj}' and got error, giving up: ${error}`);
}
} else {
throw e;
throw error;
}
}
}
4 changes: 2 additions & 2 deletions lib/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export function makeZoneAwareAddListener(
// accessing the handler object here will cause an exception to be thrown which
// will fail tests prematurely.
validZoneHandler = data.handler && data.handler.toString() === '[object FunctionWrapper]';
} catch (e) {
} catch (error) {
// Returning nothing here is fine, because objects in a cross-site context are unusable
return;
}
Expand Down Expand Up @@ -454,7 +454,7 @@ export function patchClass(className) {
export function createNamedFn(name: string, delegate: (self: any, args: any[]) => any): Function {
try {
return (Function('f', `return function ${name}(){return f(this, arguments)}`))(delegate);
} catch (e) {
} catch (error) {
// if we fail, we must be CSP, just return delegate.
return function() {
return delegate(this, <any>arguments);
Expand Down
10 changes: 5 additions & 5 deletions lib/zone-spec/long-stack-trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function getStacktraceWithUncaughtError(): Error {
function getStacktraceWithCaughtError(): Error {
try {
throw getStacktraceWithUncaughtError();
} catch (e) {
return e;
} catch (error) {
return error;
}
}

Expand Down Expand Up @@ -107,21 +107,21 @@ Zone['longStackTraceZoneSpec'] = <ZoneSpec>{
Object.defineProperty(error, 'stack', descriptor);
stackSetSucceeded = true;
}
} catch (e) {
} catch (err) {
}
const longStack: string = stackSetSucceeded ?
null :
renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], error.stack);
if (!stackSetSucceeded) {
try {
stackSetSucceeded = error.stack = longStack;
} catch (e) {
} catch (err) {
}
}
if (!stackSetSucceeded) {
try {
stackSetSucceeded = (error as any).longStack = longStack;
} catch (e) {
} catch (err) {
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions lib/zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@ const Zone: ZoneType = (function(global: any) {
const task = queue[i];
try {
task.zone.runTask(task, null, null);
} catch (e) {
consoleError(e);
} catch (error) {
consoleError(error);
}
}
}
Expand All @@ -1062,8 +1062,8 @@ const Zone: ZoneType = (function(global: any) {
uncaughtPromiseError.zone.runGuarded(() => {
throw uncaughtPromiseError;
});
} catch (e) {
consoleError(e);
} catch (error) {
consoleError(error);
}
}
}
Expand Down Expand Up @@ -1122,8 +1122,8 @@ const Zone: ZoneType = (function(global: any) {
throw new Error(
'Uncaught (in promise): ' + value +
(value && value.stack ? '\n' + value.stack : ''));
} catch (e) {
const error: UncaughtPromiseError = e;
} catch (err) {
const error: UncaughtPromiseError = err;
error.rejection = value;
error.promise = promise;
error.zone = Zone.current;
Expand Down Expand Up @@ -1240,8 +1240,8 @@ const Zone: ZoneType = (function(global: any) {
promise[symbolValue] = []; // queue;
try {
executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
} catch (e) {
resolvePromise(promise, false, e);
} catch (error) {
resolvePromise(promise, false, error);
}
}

Expand Down Expand Up @@ -1291,7 +1291,7 @@ const Zone: ZoneType = (function(global: any) {
try {
// In MS Edge this throws
fetchPromise = global['fetch']();
} catch (e) {
} catch (error) {
// In Chrome this throws instead.
fetchPromise = global['fetch']('about:blank');
}
Expand Down

0 comments on commit 33d0d8d

Please sign in to comment.