mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Introduce HasJavascriptExceptionMetadata interface
Summary: @public Introduces `HasJavascriptExceptionMetadata`, a thin interface to be implemented by all RN (Android) exception classes that represent JavaScript errors (primarily `JavascriptException` and any subclasses). Also adds a builder-style API for setting the `extraDataAsJson` field on `JavascriptException` instances. Reviewed By: abhinavbatra Differential Revision: D16090574 fbshipit-source-id: 427a0d371f1cb4e6fe2e62a91db7857a191fdb8c
This commit is contained in:
committed by
Facebook Github Bot
parent
f7695e0183
commit
6fb1690de1
@@ -6,13 +6,27 @@
|
||||
*/
|
||||
package com.facebook.react.common;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A JS exception that was propagated to native. In debug mode, these exceptions are normally shown
|
||||
* to developers in a redbox.
|
||||
*/
|
||||
public class JavascriptException extends RuntimeException {
|
||||
public class JavascriptException extends RuntimeException
|
||||
implements HasJavascriptExceptionMetadata {
|
||||
|
||||
private @Nullable String extraDataAsJson;
|
||||
|
||||
public JavascriptException(String jsStackTrace) {
|
||||
super(jsStackTrace);
|
||||
}
|
||||
|
||||
public @Nullable String getExtraDataAsJson() {
|
||||
return this.extraDataAsJson;
|
||||
}
|
||||
|
||||
public JavascriptException setExtraDataAsJson(@Nullable String extraDataAsJson) {
|
||||
this.extraDataAsJson = extraDataAsJson;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user