From 151f6b48869d45f2edb1fc9551d04f018e848f69 Mon Sep 17 00:00:00 2001 From: Salakar Date: Fri, 17 Aug 2018 20:15:14 +0100 Subject: [PATCH] [functions][js] re-write HttpsError class to not extend Error - Babel 7 bug with extending builtin classes.. --- src/modules/functions/HttpsError.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/functions/HttpsError.js b/src/modules/functions/HttpsError.js index 70bf8e21..3ff55325 100644 --- a/src/modules/functions/HttpsError.js +++ b/src/modules/functions/HttpsError.js @@ -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; } }