Refactor: JsErrorHandler: Rename handleJsError to handleFatalError (#43957)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43957

Right now, JsErrorHandler is only used to handle fatal exceptions.

So, let's just scope handleJsError down to handleFatalError.

Changelog: [General][Breaking] - JsErrorHandler: Rename handleJsError to handleFatalError

Reviewed By: cortinico

Differential Revision: D55547901

fbshipit-source-id: 261e0c8fea2852bc95e53c688d90d012d4abea34
This commit is contained in:
Ramanpreet Nara
2024-04-08 19:36:04 -07:00
committed by Facebook GitHub Bot
parent ba3e078c04
commit c041b9f40f
3 changed files with 5 additions and 7 deletions
@@ -97,13 +97,11 @@ JsErrorHandler::JsErrorHandler(
JsErrorHandler::~JsErrorHandler() {}
void JsErrorHandler::handleJsError(const jsi::JSError& error, bool isFatal) {
void JsErrorHandler::handleFatalError(const jsi::JSError& error) {
// TODO: Current error parsing works and is stable. Can investigate using
// REGEX_HERMES to get additional Hermes data, though it requires JS setup.
if (isFatal) {
_hasHandledFatalError = true;
}
ParsedError parsedError = parseErrorStack(error, isFatal, false);
_hasHandledFatalError = true;
ParsedError parsedError = parseErrorStack(error, true, false);
_jsErrorHandlingFunc(parsedError);
}
@@ -32,7 +32,7 @@ class JsErrorHandler {
explicit JsErrorHandler(JsErrorHandlingFunc jsErrorHandlingFunc);
~JsErrorHandler();
void handleJsError(const jsi::JSError& error, bool isFatal);
void handleFatalError(const jsi::JSError& error);
bool hasHandledFatalError();
private:
@@ -222,7 +222,7 @@ void ReactInstance::loadScript(
strongBufferedRuntimeExecuter->flush();
}
} catch (jsi::JSError& error) {
jsErrorHandler_->handleJsError(error, true);
jsErrorHandler_->handleFatalError(error);
}
});
}