mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 20:15:11 +00:00
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 String JS_BUNDLE_FILE_NAME = "ReactNativeDevBundle.js";
|
||||
private static enum ErrorType {
|
||||
JS,
|
||||
NATIVE
|
||||
}
|
||||
|
||||
private static final String EXOPACKAGE_LOCATION_FORMAT
|
||||
= "/data/local/tmp/exopackage/%s//secondary-dex";
|
||||
@ -184,7 +188,7 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||
|
||||
@Override
|
||||
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
|
||||
public void showNewJSError(String message, ReadableArray details, int errorCookie) {
|
||||
showNewError(message, StackTraceHelper.convertJsStackTrace(details), errorCookie);
|
||||
showNewError(message, StackTraceHelper.convertJsStackTrace(details), errorCookie, ErrorType.JS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -224,8 +228,9 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||
StackFrame[] stack = StackTraceHelper.convertJsStackTrace(details);
|
||||
mRedBoxDialog.setExceptionDetails(message, stack);
|
||||
mRedBoxDialog.setErrorCookie(errorCookie);
|
||||
// JS errors are reported here after source mapping.
|
||||
if (mRedBoxHandler != null) {
|
||||
mRedBoxHandler.handleRedbox(message, stack);
|
||||
mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.JS);
|
||||
}
|
||||
mRedBoxDialog.show();
|
||||
}
|
||||
@ -243,7 +248,8 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||
private void showNewError(
|
||||
final String message,
|
||||
final StackFrame[] stack,
|
||||
final int errorCookie) {
|
||||
final int errorCookie,
|
||||
final ErrorType errorType) {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
@ -259,8 +265,10 @@ public class DevSupportManagerImpl implements DevSupportManager {
|
||||
}
|
||||
mRedBoxDialog.setExceptionDetails(message, stack);
|
||||
mRedBoxDialog.setErrorCookie(errorCookie);
|
||||
if (mRedBoxHandler != null) {
|
||||
mRedBoxHandler.handleRedbox(message, stack);
|
||||
// Only report native errors here. JS errors are reported
|
||||
// inside {@link #updateJSError} after source mapping.
|
||||
if (mRedBoxHandler != null && errorType == ErrorType.NATIVE) {
|
||||
mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.NATIVE);
|
||||
}
|
||||
mRedBoxDialog.show();
|
||||
}
|
||||
|
@ -17,5 +17,17 @@ import com.facebook.react.devsupport.StackTraceHelper.StackFrame;
|
||||
* The implementation should be passed by {@link #setRedBoxHandler} in {@link ReactInstanceManager}.
|
||||
*/
|
||||
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…
x
Reference in New Issue
Block a user