Enable Logging information from redboxes in Android Ads Manager to Scuba
Reviewed By: mkonicek Differential Revision: D3433990 fbshipit-source-id: 54fa60fa746c9d0d834f86b7dd2e3ef18a694a32
This commit is contained in:
parent
c6020a0ef4
commit
ee0333c65d
|
@ -82,6 +82,10 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||||
|
|
||||||
private static final int JAVA_ERROR_COOKIE = -1;
|
private static final int JAVA_ERROR_COOKIE = -1;
|
||||||
private static final String JS_BUNDLE_FILE_NAME = "ReactNativeDevBundle.js";
|
private static final String JS_BUNDLE_FILE_NAME = "ReactNativeDevBundle.js";
|
||||||
|
private static enum ErrorType {
|
||||||
|
JS,
|
||||||
|
NATIVE
|
||||||
|
}
|
||||||
|
|
||||||
private static final String EXOPACKAGE_LOCATION_FORMAT
|
private static final String EXOPACKAGE_LOCATION_FORMAT
|
||||||
= "/data/local/tmp/exopackage/%s//secondary-dex";
|
= "/data/local/tmp/exopackage/%s//secondary-dex";
|
||||||
|
@ -184,7 +188,7 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showNewJavaError(String message, Throwable e) {
|
public void showNewJavaError(String message, Throwable e) {
|
||||||
showNewError(message, StackTraceHelper.convertJavaStackTrace(e), JAVA_ERROR_COOKIE);
|
showNewError(message, StackTraceHelper.convertJavaStackTrace(e), JAVA_ERROR_COOKIE, ErrorType.NATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,7 +205,7 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showNewJSError(String message, ReadableArray details, int errorCookie) {
|
public void showNewJSError(String message, ReadableArray details, int errorCookie) {
|
||||||
showNewError(message, StackTraceHelper.convertJsStackTrace(details), errorCookie);
|
showNewError(message, StackTraceHelper.convertJsStackTrace(details), errorCookie, ErrorType.JS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -224,8 +228,9 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||||
StackFrame[] stack = StackTraceHelper.convertJsStackTrace(details);
|
StackFrame[] stack = StackTraceHelper.convertJsStackTrace(details);
|
||||||
mRedBoxDialog.setExceptionDetails(message, stack);
|
mRedBoxDialog.setExceptionDetails(message, stack);
|
||||||
mRedBoxDialog.setErrorCookie(errorCookie);
|
mRedBoxDialog.setErrorCookie(errorCookie);
|
||||||
|
// JS errors are reported here after source mapping.
|
||||||
if (mRedBoxHandler != null) {
|
if (mRedBoxHandler != null) {
|
||||||
mRedBoxHandler.handleRedbox(message, stack);
|
mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.JS);
|
||||||
}
|
}
|
||||||
mRedBoxDialog.show();
|
mRedBoxDialog.show();
|
||||||
}
|
}
|
||||||
|
@ -243,7 +248,8 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||||
private void showNewError(
|
private void showNewError(
|
||||||
final String message,
|
final String message,
|
||||||
final StackFrame[] stack,
|
final StackFrame[] stack,
|
||||||
final int errorCookie) {
|
final int errorCookie,
|
||||||
|
final ErrorType errorType) {
|
||||||
UiThreadUtil.runOnUiThread(
|
UiThreadUtil.runOnUiThread(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -259,8 +265,10 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||||
}
|
}
|
||||||
mRedBoxDialog.setExceptionDetails(message, stack);
|
mRedBoxDialog.setExceptionDetails(message, stack);
|
||||||
mRedBoxDialog.setErrorCookie(errorCookie);
|
mRedBoxDialog.setErrorCookie(errorCookie);
|
||||||
if (mRedBoxHandler != null) {
|
// Only report native errors here. JS errors are reported
|
||||||
mRedBoxHandler.handleRedbox(message, stack);
|
// inside {@link #updateJSError} after source mapping.
|
||||||
|
if (mRedBoxHandler != null && errorType == ErrorType.NATIVE) {
|
||||||
|
mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.NATIVE);
|
||||||
}
|
}
|
||||||
mRedBoxDialog.show();
|
mRedBoxDialog.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,17 @@ import com.facebook.react.devsupport.StackTraceHelper.StackFrame;
|
||||||
* The implementation should be passed by {@link #setRedBoxHandler} in {@link ReactInstanceManager}.
|
* The implementation should be passed by {@link #setRedBoxHandler} in {@link ReactInstanceManager}.
|
||||||
*/
|
*/
|
||||||
public interface RedBoxHandler {
|
public interface RedBoxHandler {
|
||||||
void handleRedbox(String title, StackFrame[] stack);
|
enum ErrorType {
|
||||||
|
JS("JS"),
|
||||||
|
NATIVE("Native");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
ErrorType(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void handleRedbox(String title, StackFrame[] stack, ErrorType errorType);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue