List nested exception in Redbox

Reviewed By: AaaChiuuu

Differential Revision: D4928968

fbshipit-source-id: 3af8f4ad0f76f035d2167fbf4b4381b6503f6bd2
This commit is contained in:
Pieter De Baets 2017-04-21 05:22:33 -07:00 committed by Facebook Github Bot
parent 9bbbfb46ea
commit b4932082c7
1 changed files with 11 additions and 6 deletions

View File

@ -235,16 +235,21 @@ public class DevSupportManagerImpl implements
@Override
public void handleException(Exception e) {
if (mIsDevSupportEnabled) {
String message = e.getMessage();
Throwable cause = e.getCause();
while (cause != null) {
message += "\n\n" + cause.getMessage();
cause = cause.getCause();
}
if (e instanceof JSException) {
FLog.e(ReactConstants.TAG, "Exception in native call from JS", e);
message += "\n\n" + ((JSException) e).getStack();
// TODO #11638796: convert the stack into something useful
showNewError(
e.getMessage() + "\n\n" + ((JSException) e).getStack(),
new StackFrame[] {},
JSEXCEPTION_ERROR_COOKIE,
ErrorType.JS);
showNewError(message, new StackFrame[] {}, JSEXCEPTION_ERROR_COOKIE, ErrorType.JS);
} else {
showNewJavaError(e.getMessage(), e);
showNewJavaError(message, e);
}
} else {
mDefaultNativeModuleCallExceptionHandler.handleException(e);