Skip to content

Commit c01d9fe

Browse files
committed
Output warning when stack trace is undefined
1 parent ab17832 commit c01d9fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

React/Base/RCTJSCErrorHandling.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#import "RCTAssert.h"
1515
#import "RCTJSStackFrame.h"
16+
#import "RCTLog.h"
1617

1718
NSString *const RCTJSExceptionUnsymbolicatedStackTraceKey = @"RCTJSExceptionUnsymbolicatedStackTraceKey";
1819

@@ -25,7 +26,9 @@
2526
userInfo[NSLocalizedFailureReasonErrorKey] = exceptionMessage;
2627
}
2728
NSString *const stack = [exception[@"stack"] toString];
28-
if ([stack length]) {
29+
if ([@"undefined" isEqualToString:stack]) {
30+
RCTLogWarn(@"Couldn't get stack trace for %@:%@", exception[@"sourceURL"], exception[@"line"]);
31+
} else if ([stack length]) {
2932
NSArray<RCTJSStackFrame *> *const unsymbolicatedFrames = [RCTJSStackFrame stackFramesWithLines:stack];
3033
userInfo[RCTJSStackTraceKey] = unsymbolicatedFrames;
3134
}

0 commit comments

Comments
 (0)