Skip to content

Commit

Permalink
Refactor: JsErrorHandler: Rename handleJsError to handleFatalError (#…
Browse files Browse the repository at this point in the history
…43957)

Summary:
Pull Request resolved: #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
  • Loading branch information
RSNara authored and facebook-github-bot committed Apr 9, 2024
1 parent ba3e078 commit c041b9f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void ReactInstance::loadScript(
strongBufferedRuntimeExecuter->flush();
}
} catch (jsi::JSError& error) {
jsErrorHandler_->handleJsError(error, true);
jsErrorHandler_->handleFatalError(error);
}
});
}
Expand Down

0 comments on commit c041b9f

Please sign in to comment.