Consistently handle startup errors
Summary: If we use RCTLogError, we show a redbox with a native stacktrace before we can actually show the JS stacktrace (which is only done through dispatch_async). Instead use RCTLogWarn so its logged to console but not reported as a redbox. Also fix call to RCTNSErrorFromJSErrorRef off the main thread RCTJSCExecutor. Reviewed By: majak, mmmulani Differential Revision: D3886813 fbshipit-source-id: 119d04858cb0c85c79e12ff8a79806711f8e0b27
This commit is contained in:
parent
c6024f6391
commit
21fda19ca9
|
@ -109,6 +109,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
__block NSData *sourceCode;
|
||||
[self loadSource:^(NSError *error, NSData *source, __unused int64_t sourceLength) {
|
||||
if (error) {
|
||||
RCTLogWarn(@"Failed to load source: %@", error);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf stopLoadingWithError:error];
|
||||
});
|
||||
|
@ -153,6 +154,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
[weakSelf injectJSONConfiguration:config onComplete:^(NSError *error) {
|
||||
[performanceLogger markStopForTag:RCTPLNativeModuleInjectConfig];
|
||||
if (error) {
|
||||
RCTLogWarn(@"Failed to inject config: %@", error);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf stopLoadingWithError:error];
|
||||
});
|
||||
|
@ -502,7 +504,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
|||
}
|
||||
|
||||
if (loadError) {
|
||||
RCTLogError(@"Failed to execute source code: %@", [loadError localizedDescription]);
|
||||
RCTLogWarn(@"Failed to execute source code: %@", [loadError localizedDescription]);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self stopLoadingWithError:loadError];
|
||||
});
|
||||
|
|
|
@ -828,8 +828,9 @@ static void executeRandomAccessModule(RCTJSCExecutor *executor, uint32_t moduleI
|
|||
jscWrapper->JSStringRelease(sourceURL);
|
||||
|
||||
if (!result) {
|
||||
NSError *error = RCTNSErrorFromJSErrorRef(jsError, ctx, jscWrapper);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
RCTFatal(RCTNSErrorFromJSErrorRef(jsError, ctx, jscWrapper));
|
||||
RCTFatal(error);
|
||||
[executor invalidate];
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue