Log softerror when attempting to use ReactInstanceManager in Bridgeless Mode

Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D34060026

fbshipit-source-id: 41441c0b16c4ef0248957eae11d9c9bc642f6d34
This commit is contained in:
Paige Sun
2022-02-10 15:00:50 -08:00
committed by Facebook GitHub Bot
parent 9bc6c0f8a5
commit f9fa385eb1
2 changed files with 33 additions and 0 deletions
@@ -0,0 +1,27 @@
/*
* 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.bridge;
/**
* Extends RuntimeException so that it may be caught by a {@link ReactSoftExceptionListener}. Any
* {@link ReactSoftExceptionListener} that catches a ReactNoCrashBridgeNotAllowedSoftException
* should log it only and not crash, no matter what.
*/
public class ReactNoCrashBridgeNotAllowedSoftException extends ReactNoCrashSoftException {
public ReactNoCrashBridgeNotAllowedSoftException(String m) {
super(m);
}
public ReactNoCrashBridgeNotAllowedSoftException(Throwable e) {
super(e);
}
public ReactNoCrashBridgeNotAllowedSoftException(String m, Throwable e) {
super(m, e);
}
}
@@ -40,6 +40,12 @@ public class ReactSoftExceptionLogger {
sListeners.clear();
}
@DoNotStrip
public static void logSoftExceptionVerbose(final String category, final Throwable cause) {
logSoftException(
category + "|" + cause.getClass().getSimpleName() + ":" + cause.getMessage(), cause);
}
@DoNotStrip
public static void logSoftException(final String category, final Throwable cause) {
if (sListeners.size() > 0) {