Skip to content

Commit c041b9f

Browse files
RSNarafacebook-github-bot
authored andcommitted
Refactor: JsErrorHandler: Rename handleJsError to handleFatalError (#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
1 parent ba3e078 commit c041b9f

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

packages/react-native/ReactCommon/jserrorhandler/JsErrorHandler.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ JsErrorHandler::JsErrorHandler(
9797

9898
JsErrorHandler::~JsErrorHandler() {}
9999

100-
void JsErrorHandler::handleJsError(const jsi::JSError& error, bool isFatal) {
100+
void JsErrorHandler::handleFatalError(const jsi::JSError& error) {
101101
// TODO: Current error parsing works and is stable. Can investigate using
102102
// REGEX_HERMES to get additional Hermes data, though it requires JS setup.
103-
if (isFatal) {
104-
_hasHandledFatalError = true;
105-
}
106-
ParsedError parsedError = parseErrorStack(error, isFatal, false);
103+
_hasHandledFatalError = true;
104+
ParsedError parsedError = parseErrorStack(error, true, false);
107105
_jsErrorHandlingFunc(parsedError);
108106
}
109107

packages/react-native/ReactCommon/jserrorhandler/JsErrorHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class JsErrorHandler {
3232
explicit JsErrorHandler(JsErrorHandlingFunc jsErrorHandlingFunc);
3333
~JsErrorHandler();
3434

35-
void handleJsError(const jsi::JSError& error, bool isFatal);
35+
void handleFatalError(const jsi::JSError& error);
3636
bool hasHandledFatalError();
3737

3838
private:

packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void ReactInstance::loadScript(
222222
strongBufferedRuntimeExecuter->flush();
223223
}
224224
} catch (jsi::JSError& error) {
225-
jsErrorHandler_->handleJsError(error, true);
225+
jsErrorHandler_->handleFatalError(error);
226226
}
227227
});
228228
}

0 commit comments

Comments
 (0)