Files
react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactNoCrashSoftException.java
T
Joshua Gross 94cb4bf90c In modules or classes that call ReactApplicationContext.getJSModule, ensure that there's still a CatalystInstance alive
Summary:
In D18032458 we introduce getReactApplicationContextIfActiveOrWarn. In this diff, modules that access a JS or Native module through ReactApplicationContext need to check if the CatalystInstance is still alive before continuing.

Modules that don't derive from `ReactContextBaseJavaModule` manually check for the catalyst impl and log their own SoftExceptions.

In this diff we also introduce SoftExceptions that by contract never cause crashes, even in debug mode.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18112989

fbshipit-source-id: 868f01f388aa2db3518db9f873f2afc2a62eed45
2019-10-24 17:29:08 -07:00

20 lines
620 B
Java

/*
* Copyright (c) Facebook, Inc. and its 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.bridge;
/**
* Extends RuntimeException so that it may be caught by a {@link ReactSoftExceptionListener}. Any
* {@link ReactSoftExceptionListener} that catches a ReactNoCrashSoftException should log it only
* and not crash, no matter what.
*/
public class ReactNoCrashSoftException extends RuntimeException {
public ReactNoCrashSoftException(String detailMessage) {
super(detailMessage);
}
}