|
48 | 48 | import com.facebook.react.devsupport.interfaces.DevSplitBundleCallback;
|
49 | 49 | import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
50 | 50 | import com.facebook.react.devsupport.interfaces.ErrorCustomizer;
|
| 51 | +import com.facebook.react.devsupport.interfaces.ErrorType; |
51 | 52 | import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
|
52 | 53 | import com.facebook.react.devsupport.interfaces.StackFrame;
|
53 | 54 | import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
|
@@ -85,12 +86,6 @@ public interface CallbackWithBundleLoader {
|
85 | 86 | "flipper://null/Hermesdebuggerrn?device=React%20Native";
|
86 | 87 | private static final String FLIPPER_DEVTOOLS_URL = "flipper://null/React?device=React%20Native";
|
87 | 88 | private boolean mIsSamplingProfilerEnabled = false;
|
88 |
| - |
89 |
| - private enum ErrorType { |
90 |
| - JS, |
91 |
| - NATIVE |
92 |
| - } |
93 |
| - |
94 | 89 | private static final String EXOPACKAGE_LOCATION_FORMAT =
|
95 | 90 | "/data/local/tmp/exopackage/%s//secondary-dex";
|
96 | 91 |
|
@@ -124,6 +119,7 @@ private enum ErrorType {
|
124 | 119 | private @Nullable RedBoxHandler mRedBoxHandler;
|
125 | 120 | private @Nullable String mLastErrorTitle;
|
126 | 121 | private @Nullable StackFrame[] mLastErrorStack;
|
| 122 | + private @Nullable ErrorType mLastErrorType; |
127 | 123 | private int mLastErrorCookie = 0;
|
128 | 124 | private @Nullable DevBundleDownloadListener mBundleDownloadListener;
|
129 | 125 | private @Nullable List<ErrorCustomizer> mErrorCustomizers;
|
@@ -353,7 +349,7 @@ public void run() {
|
353 | 349 | updateLastErrorInfo(message, stack, errorCookie, ErrorType.JS);
|
354 | 350 | // JS errors are reported here after source mapping.
|
355 | 351 | if (mRedBoxHandler != null) {
|
356 |
| - mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.JS); |
| 352 | + mRedBoxHandler.handleRedbox(message, stack, ErrorType.JS); |
357 | 353 | mRedBoxDialog.resetReporting();
|
358 | 354 | }
|
359 | 355 | mRedBoxDialog.show();
|
@@ -420,7 +416,7 @@ public void run() {
|
420 | 416 | // Only report native errors here. JS errors are reported
|
421 | 417 | // inside {@link #updateJSError} after source mapping.
|
422 | 418 | if (mRedBoxHandler != null && errorType == ErrorType.NATIVE) {
|
423 |
| - mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.NATIVE); |
| 419 | + mRedBoxHandler.handleRedbox(message, stack, ErrorType.NATIVE); |
424 | 420 | }
|
425 | 421 | mRedBoxDialog.resetReporting();
|
426 | 422 | mRedBoxDialog.show();
|
@@ -1002,6 +998,11 @@ public void run() {
|
1002 | 998 | return mLastErrorStack;
|
1003 | 999 | }
|
1004 | 1000 |
|
| 1001 | + @Override |
| 1002 | + public @Nullable ErrorType getLastErrorType() { |
| 1003 | + return mLastErrorType; |
| 1004 | + } |
| 1005 | + |
1005 | 1006 | @Override
|
1006 | 1007 | public void onPackagerConnected() {
|
1007 | 1008 | // No-op
|
@@ -1083,6 +1084,7 @@ private void updateLastErrorInfo(
|
1083 | 1084 | mLastErrorTitle = message;
|
1084 | 1085 | mLastErrorStack = stack;
|
1085 | 1086 | mLastErrorCookie = errorCookie;
|
| 1087 | + mLastErrorType = errorType; |
1086 | 1088 | }
|
1087 | 1089 |
|
1088 | 1090 | private void reloadJSInProxyMode() {
|
|
0 commit comments