mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 22:47:58 +08:00
crash gracefully on fatal js errors (take two)
Reviewed By: AaaChiuuu Differential Revision: D2773513 fb-gh-sync-id: f8e50ad12e808caf1d85c6c7859c04fcabdaaeae
This commit is contained in:
committed by
facebook-github-bot-7
parent
f2bdb79782
commit
4866ec2767
@@ -155,7 +155,7 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
|
||||
public void handleException(Exception e) {
|
||||
if (mIsDevSupportEnabled) {
|
||||
FLog.e(ReactConstants.TAG, "Exception in native call from JS", e);
|
||||
showNewError(e.getMessage(), StackTraceHelper.convertJavaStackTrace(e), JAVA_ERROR_COOKIE);
|
||||
showNewJavaError(e.getMessage(), e);
|
||||
} else {
|
||||
if (e instanceof RuntimeException) {
|
||||
// Because we are rethrowing the original exception, the original stacktrace will be
|
||||
@@ -167,6 +167,10 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public void showNewJavaError(String message, Throwable e) {
|
||||
showNewError(message, StackTraceHelper.convertJavaStackTrace(e), JAVA_ERROR_COOKIE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add option item to dev settings dialog displayed by this manager. In the case user select given
|
||||
* option from that dialog, the appropriate handler passed as {@param optionHandler} will be
|
||||
@@ -555,10 +559,9 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showNewError(
|
||||
showNewJavaError(
|
||||
mApplicationContext.getString(R.string.catalyst_remotedbg_error),
|
||||
StackTraceHelper.convertJavaStackTrace(cause),
|
||||
JAVA_ERROR_COOKIE);
|
||||
cause);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -590,15 +593,11 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
|
||||
public void run() {
|
||||
if (cause instanceof DebugServerException) {
|
||||
DebugServerException debugServerException = (DebugServerException) cause;
|
||||
showNewError(
|
||||
debugServerException.description,
|
||||
StackTraceHelper.convertJavaStackTrace(cause),
|
||||
JAVA_ERROR_COOKIE);
|
||||
showNewJavaError(debugServerException.description, cause);
|
||||
} else {
|
||||
showNewError(
|
||||
showNewJavaError(
|
||||
mApplicationContext.getString(R.string.catalyst_jsload_error),
|
||||
StackTraceHelper.convertJavaStackTrace(cause),
|
||||
JAVA_ERROR_COOKIE);
|
||||
cause);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user