From 8e2d1f01d3b85565cee924955056d6d041a3e968 Mon Sep 17 00:00:00 2001 From: Dirk Eismann Date: Wed, 16 Mar 2022 22:32:55 +0100 Subject: [PATCH] fix: use (anonymous) for empty functionNames when generating stack information (#66) closes #65 --- packages/firebase-crashlytics/index.android.ts | 2 +- packages/firebase-crashlytics/index.ios.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/firebase-crashlytics/index.android.ts b/packages/firebase-crashlytics/index.android.ts index b5879ff0..d0d3059c 100644 --- a/packages/firebase-crashlytics/index.android.ts +++ b/packages/firebase-crashlytics/index.android.ts @@ -73,7 +73,7 @@ export class Crashlytics implements ICrashlytics { StackTrace.fromError(error).then((stack) => { const traceElements = Array.create('java.lang.StackTraceElement', stack.length); stack.forEach((item, i) => { - traceElements[i] = new java.lang.StackTraceElement('', item.functionName, item.fileName, -1); + traceElements[i] = new java.lang.StackTraceElement('', item.functionName || '(anonymous)', item.fileName, -1); }); const t = new java.lang.Throwable(error.message); t.setStackTrace(traceElements); diff --git a/packages/firebase-crashlytics/index.ios.ts b/packages/firebase-crashlytics/index.ios.ts index ada30a9d..925dc452 100644 --- a/packages/firebase-crashlytics/index.ios.ts +++ b/packages/firebase-crashlytics/index.ios.ts @@ -67,7 +67,7 @@ export class Crashlytics implements ICrashlytics { StackTrace.fromError(error).then((stack) => { const traceElements = []; stack.forEach((item, i) => { - traceElements[i] = FIRStackFrame.stackFrameWithSymbolFileLine(item.functionName, item.fileName, item.lineNumber); + traceElements[i] = FIRStackFrame.stackFrameWithSymbolFileLine(item.functionName || '(anonymous)', item.fileName, item.lineNumber); }); const e = FIRExceptionModel.exceptionModelWithNameReason('JavaScriptError', error.message); this.native.recordExceptionModel(e);