setNativeExceptionHandler is not working if error is not fatal
KESHAmambo opened this issue · 3 comments
Environment: React-Native 0.63, iOS
Steps to reproduce:
I tried to produce native error within module @react-native-community/clipboard:
(injected error throwing
NSLog(@"RAISING A TEST EXCEPTION");
[NSException raise:@"TEST EXCEPTION" format:@"THIS IS A TEST EXCEPTION"];
)
File: RNCClipboard.m:
RCT_EXPORT_METHOD(getString:(RCTPromiseResolveBlock)resolve
reject:(__unused RCTPromiseRejectBlock)reject)
{
UIPasteboard *clipboard = [UIPasteboard generalPasteboard];
NSLog(@"RAISING A TEST EXCEPTION");
[NSException raise:@"TEST EXCEPTION" format:@"THIS IS A TEST EXCEPTION"];
resolve((clipboard.string ? : @""));
}
Expected result:
callback transmitted to setNativeExceptionHandler
is getting called on Clipboard.getString()
Actual result:
callback transmitted to setNativeExceptionHandler
is not invoked on error. Instead only standard RedError screen (presented on screenshot) is shown.
Also I have to add that rn-test-exception-handler library for testing setNativeExceptionHandler
does not work as it does not expose interface to React-Native JS code (as mentioned in its project issues)
Also I have to add that rn-test-exception-handler library for testing
setNativeExceptionHandler
does not work as it does not expose interface to React-Native JS code (as mentioned in its project issues)
I fixed rn-test-exception-handler by manually installing the library in Xcode - don't know why autolinking didn't work
About the red screen - have you tried dismissing it? In my implementation the red-screen shows but my app still gets the exception in the handler.
I have an error with this.
When i get undefined object , the NativeExceptionHandler do nothing.
Please help me
I need it a lot.