mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor: RuntimeScheduler: Delete ErrorUtils.h (#43953)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43953 RuntimeScheduler's ErrorUtils.h is redundant. Let's just remove it. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D55547905 fbshipit-source-id: 5263c9fca8ae32bbfc672f0e16b79ee177cdd421
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9ad71387e8
commit
3094273e8b
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
inline static void handleFatalError(
|
||||
jsi::Runtime& runtime,
|
||||
const jsi::JSError& error) {
|
||||
auto reportFatalError = "reportFatalError";
|
||||
auto errorUtils = runtime.global().getProperty(runtime, "ErrorUtils");
|
||||
if (errorUtils.isUndefined() || !errorUtils.isObject() ||
|
||||
!errorUtils.getObject(runtime).hasProperty(runtime, reportFatalError)) {
|
||||
// ErrorUtils was not set up. This probably means the bundle didn't
|
||||
// load properly.
|
||||
throw jsi::JSError(
|
||||
runtime,
|
||||
"ErrorUtils is not set up properly. Something probably went wrong trying to load the JS bundle. Trying to report error " +
|
||||
error.getMessage(),
|
||||
error.getStack());
|
||||
}
|
||||
|
||||
auto func = errorUtils.asObject(runtime).getPropertyAsFunction(
|
||||
runtime, reportFatalError);
|
||||
|
||||
func.call(runtime, error.value());
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
#include <react/renderer/debug/SystraceSection.h>
|
||||
#include <utility>
|
||||
#include "ErrorUtils.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
+3
-3
@@ -8,10 +8,10 @@
|
||||
#include "RuntimeScheduler_Legacy.h"
|
||||
#include "SchedulerPriorityUtils.h"
|
||||
|
||||
#include <cxxreact/ErrorUtils.h>
|
||||
#include <react/renderer/consistency/ScopedShadowTreeRevisionLock.h>
|
||||
#include <react/renderer/debug/SystraceSection.h>
|
||||
#include <utility>
|
||||
#include "ErrorUtils.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
@@ -139,7 +139,7 @@ void RuntimeScheduler_Legacy::callExpiredTasks(jsi::Runtime& runtime) {
|
||||
executeTask(runtime, topPriorityTask, didUserCallbackTimeout);
|
||||
}
|
||||
} catch (jsi::JSError& error) {
|
||||
handleFatalError(runtime, error);
|
||||
handleJSError(runtime, error, true);
|
||||
}
|
||||
|
||||
currentPriority_ = previousPriority;
|
||||
@@ -191,7 +191,7 @@ void RuntimeScheduler_Legacy::startWorkLoop(jsi::Runtime& runtime) {
|
||||
executeTask(runtime, topPriorityTask, didUserCallbackTimeout);
|
||||
}
|
||||
} catch (jsi::JSError& error) {
|
||||
handleFatalError(runtime, error);
|
||||
handleJSError(runtime, error, true);
|
||||
}
|
||||
|
||||
currentPriority_ = previousPriority;
|
||||
|
||||
+1
-2
@@ -14,7 +14,6 @@
|
||||
#include <react/renderer/debug/SystraceSection.h>
|
||||
#include <react/utils/OnScopeExit.h>
|
||||
#include <utility>
|
||||
#include "ErrorUtils.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
@@ -211,7 +210,7 @@ void RuntimeScheduler_Modern::startWorkLoop(
|
||||
executeTask(runtime, topPriorityTask, currentTime);
|
||||
}
|
||||
} catch (jsi::JSError& error) {
|
||||
handleFatalError(runtime, error);
|
||||
handleJSError(runtime, error, true);
|
||||
}
|
||||
|
||||
currentPriority_ = previousPriority;
|
||||
|
||||
Reference in New Issue
Block a user