Skip to content

Commit

Permalink
Merge fb7caf8 into 6fb1f77
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy authored Nov 26, 2020
2 parents 6fb1f77 + fb7caf8 commit 3ae4154
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/app/lib/internal/NativeFirebaseError.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ 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;
Expand All @@ -71,7 +74,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');
}
}
7 changes: 6 additions & 1 deletion packages/functions/lib/HttpsError.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -34,6 +36,9 @@ export default class HttpsError extends Error {
value: message,
});

this.stack = nativeErrorInstance.getStackWithMessage(`Error: ${this.message}`);
this.stack = NativeFirebaseError.getStackWithMessage(
`Error: ${this.message}`,
nativeErrorInstance.jsStack,
);
}
}

0 comments on commit 3ae4154

Please sign in to comment.