[functions][js] re-write HttpsError class to not extend Error - Babel 7 bug with extending builtin classes..
This commit is contained in:
parent
8ffa41b8ad
commit
151f6b4886
|
@ -1,13 +1,22 @@
|
|||
import type { FunctionsErrorCode } from './types.flow';
|
||||
|
||||
export default class HttpsError extends Error {
|
||||
export default class HttpsError {
|
||||
// TODO extends Error
|
||||
+details: ?any;
|
||||
|
||||
+message: string;
|
||||
|
||||
+code: FunctionsErrorCode;
|
||||
|
||||
constructor(code: FunctionsErrorCode, message?: string, details?: any) {
|
||||
super(message);
|
||||
this.details = details;
|
||||
this.code = code;
|
||||
// this.code = code;
|
||||
// this.details = details;
|
||||
// this.message = message;
|
||||
// TODO babel 7 issue... can't extend builtin classes properly.
|
||||
this._error = new Error(message);
|
||||
this._error.code = code;
|
||||
this._error.details = details;
|
||||
this._error.constructor = HttpsError;
|
||||
return this._error;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue