refactor(facade): don't expect super() to return a new Error object in BaseError (#12600)

Related to #12575
This commit is contained in:
Bradford C. Smith 2016-12-14 11:54:57 -08:00 committed by Victor Berchet
parent 821b8f09d6
commit 5031adc7a3
1 changed files with 4 additions and 1 deletions

View File

@ -18,9 +18,12 @@ export class BaseError extends Error {
_nativeError: Error; _nativeError: Error;
constructor(message: string) { constructor(message: string) {
super(message);
// Errors don't use current this, instead they create a new instance. // Errors don't use current this, instead they create a new instance.
// We have to do forward all of our api to the nativeInstance. // We have to do forward all of our api to the nativeInstance.
const nativeError = super(message) as any as Error; // TODO(bradfordcsmith): Remove this hack when
// google/closure-compiler/issues/2102 is fixed.
const nativeError = new Error(message) as any as Error;
this._nativeError = nativeError; this._nativeError = nativeError;
} }