mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove HasJavascriptExceptionMetadata interface (#45440)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45440 We only have one type of JavaScriptException anymore, so this can be simplified. Changelog: [Android][Removed] Removed HasJavascriptExceptionMetadata as a marker interface. Use JavascriptExecption directly Differential Revision: D57379390 fbshipit-source-id: a088834fddb156ceed5ccc8010d3c4acd365bf29
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b7e70968fa
commit
cb00ca954d
@@ -1709,14 +1709,10 @@ public class com/facebook/react/common/DebugServerException : java/lang/RuntimeE
|
||||
public static fun parse (Ljava/lang/String;Ljava/lang/String;)Lcom/facebook/react/common/DebugServerException;
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/common/HasJavascriptExceptionMetadata {
|
||||
public abstract fun getExtraDataAsJson ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public class com/facebook/react/common/JavascriptException : java/lang/RuntimeException, com/facebook/react/common/HasJavascriptExceptionMetadata {
|
||||
public class com/facebook/react/common/JavascriptException : java/lang/RuntimeException {
|
||||
public fun <init> (Ljava/lang/String;)V
|
||||
public fun getExtraDataAsJson ()Ljava/lang/String;
|
||||
public final fun setExtraDataAsJson (Ljava/lang/String;)Lcom/facebook/react/common/JavascriptException;
|
||||
public final fun getExtraDataAsJson ()Ljava/lang/String;
|
||||
public final fun setExtraDataAsJson (Ljava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/common/LifecycleState : java/lang/Enum {
|
||||
|
||||
+3
-1
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Extends RuntimeException so that it may be caught by a {@link ReactSoftExceptionListener}. Any
|
||||
* {@link ReactSoftExceptionListener} that catches a ReactNoCrashSoftException should log it only
|
||||
@@ -21,7 +23,7 @@ public class ReactNoCrashSoftException extends RuntimeException {
|
||||
super(e);
|
||||
}
|
||||
|
||||
public ReactNoCrashSoftException(String m, Throwable e) {
|
||||
public ReactNoCrashSoftException(String m, @Nullable Throwable e) {
|
||||
super(m, e);
|
||||
}
|
||||
}
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.common;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** A JS exception carrying metadata. */
|
||||
public interface HasJavascriptExceptionMetadata {
|
||||
|
||||
@Nullable
|
||||
String getExtraDataAsJson();
|
||||
}
|
||||
+2
-10
@@ -14,14 +14,6 @@ import com.facebook.proguard.annotations.DoNotStrip
|
||||
* to developers in a redbox.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public open class JavascriptException(jsStackTrace: String) :
|
||||
RuntimeException(jsStackTrace), HasJavascriptExceptionMetadata {
|
||||
private var extraDataAsJson: String? = null
|
||||
|
||||
override fun getExtraDataAsJson(): String? = extraDataAsJson
|
||||
|
||||
public fun setExtraDataAsJson(extraDataAsJson: String?): JavascriptException {
|
||||
this.extraDataAsJson = extraDataAsJson
|
||||
return this
|
||||
}
|
||||
public open class JavascriptException(jsStackTrace: String) : RuntimeException(jsStackTrace) {
|
||||
public var extraDataAsJson: String? = null
|
||||
}
|
||||
|
||||
+3
-2
@@ -62,8 +62,9 @@ public class ExceptionsManagerModule extends NativeExceptionsManagerSpec {
|
||||
|
||||
String extraDataAsJson = ExceptionDataHelper.getExtraDataAsJson(data);
|
||||
if (isFatal) {
|
||||
throw new JavascriptException(JSStackTrace.format(message, stack))
|
||||
.setExtraDataAsJson(extraDataAsJson);
|
||||
JavascriptException ex = new JavascriptException(JSStackTrace.format(message, stack));
|
||||
ex.setExtraDataAsJson(extraDataAsJson);
|
||||
throw ex;
|
||||
} else {
|
||||
FLog.e(ReactConstants.TAG, JSStackTrace.format(message, stack));
|
||||
if (extraDataAsJson != null) {
|
||||
|
||||
+1
-7
@@ -924,14 +924,8 @@ public class ReactHostImpl implements ReactHost {
|
||||
String callingMethod, String message, @Nullable Throwable throwable) {
|
||||
final String method = "raiseSoftException(" + callingMethod + ")";
|
||||
log(method, message);
|
||||
if (throwable != null) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException(method + ": " + message, throwable));
|
||||
return;
|
||||
}
|
||||
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException(method + ": " + message));
|
||||
TAG, new ReactNoCrashSoftException(method + ": " + message, throwable));
|
||||
}
|
||||
|
||||
private Executor getDefaultReactInstanceExecutor() {
|
||||
|
||||
Reference in New Issue
Block a user