From c65ba0aae13536cad6ae90944a038b6268746818 Mon Sep 17 00:00:00 2001 From: blashadow Date: Sat, 6 Jun 2020 19:26:50 -0400 Subject: [PATCH 1/3] change instance method to static method to avoid fatal error while parsing error --- packages/app/lib/internal/NativeFirebaseError.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/app/lib/internal/NativeFirebaseError.js b/packages/app/lib/internal/NativeFirebaseError.js index 9599652785..81259b85e3 100644 --- a/packages/app/lib/internal/NativeFirebaseError.js +++ b/packages/app/lib/internal/NativeFirebaseError.js @@ -59,7 +59,7 @@ export default class NativeFirebaseError extends Error { value: userInfo.nativeErrorMessage || null, }); - this.stack = this.getStackWithMessage(`NativeFirebaseError: ${this.message}`); + this.stack = NativeFirebaseError.getStackWithMessage(`NativeFirebaseError: ${this.message}`, this.jsStack); // Unused // this.nativeStackIOS = nativeError.nativeStackIOS; @@ -71,7 +71,7 @@ export default class NativeFirebaseError extends Error { * * @returns {string} */ - getStackWithMessage(message) { - return [message, ...this.jsStack.split('\n').slice(2, 13)].join('\n'); + static getStackWithMessage(message, jsStack) { + return [message, ...jsStack.split('\n').slice(2, 13)].join('\n'); } } From ac2d51e95142bd3730aa2df15a5dbd469473ca1e Mon Sep 17 00:00:00 2001 From: blashadow Date: Sun, 7 Jun 2020 14:35:50 -0400 Subject: [PATCH 2/3] http error --- packages/functions/lib/HttpsError.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/functions/lib/HttpsError.js b/packages/functions/lib/HttpsError.js index 306502f617..b6231484d9 100644 --- a/packages/functions/lib/HttpsError.js +++ b/packages/functions/lib/HttpsError.js @@ -15,6 +15,8 @@ * */ +import { NativeFirebaseError } from "@react-native-firebase/app/lib/internal"; + export default class HttpsError extends Error { constructor(code, message, details, nativeErrorInstance) { super(message); @@ -34,6 +36,6 @@ export default class HttpsError extends Error { value: message, }); - this.stack = nativeErrorInstance.getStackWithMessage(`Error: ${this.message}`); + this.stack = NativeFirebaseError.getStackWithMessage(`Error: ${this.message}`, nativeErrorInstance.jsStack); } } From fb7caf817aa1958d9bb79dd3af8d28cc4952592e Mon Sep 17 00:00:00 2001 From: blashadow Date: Sun, 7 Jun 2020 14:44:49 -0400 Subject: [PATCH 3/3] lint errors --- packages/app/lib/internal/NativeFirebaseError.js | 5 ++++- packages/functions/lib/HttpsError.js | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/app/lib/internal/NativeFirebaseError.js b/packages/app/lib/internal/NativeFirebaseError.js index 81259b85e3..b458e51739 100644 --- a/packages/app/lib/internal/NativeFirebaseError.js +++ b/packages/app/lib/internal/NativeFirebaseError.js @@ -59,7 +59,10 @@ export default class NativeFirebaseError extends Error { value: userInfo.nativeErrorMessage || null, }); - this.stack = NativeFirebaseError.getStackWithMessage(`NativeFirebaseError: ${this.message}`, this.jsStack); + this.stack = NativeFirebaseError.getStackWithMessage( + `NativeFirebaseError: ${this.message}`, + this.jsStack, + ); // Unused // this.nativeStackIOS = nativeError.nativeStackIOS; diff --git a/packages/functions/lib/HttpsError.js b/packages/functions/lib/HttpsError.js index b6231484d9..3c4a6e59d0 100644 --- a/packages/functions/lib/HttpsError.js +++ b/packages/functions/lib/HttpsError.js @@ -15,7 +15,7 @@ * */ -import { NativeFirebaseError } from "@react-native-firebase/app/lib/internal"; +import { NativeFirebaseError } from '@react-native-firebase/app/lib/internal'; export default class HttpsError extends Error { constructor(code, message, details, nativeErrorInstance) { @@ -36,6 +36,9 @@ export default class HttpsError extends Error { value: message, }); - this.stack = NativeFirebaseError.getStackWithMessage(`Error: ${this.message}`, nativeErrorInstance.jsStack); + this.stack = NativeFirebaseError.getStackWithMessage( + `Error: ${this.message}`, + nativeErrorInstance.jsStack, + ); } }