Skip to content

Commit f9c7007

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Move RecoverableError to its own target and the frameworks tier (#59027)
Summary: Pull Request resolved: #59027 `cxxreact/RecoverableError.h` was exported only by `cxxreact:bridge` and guarded as private, so libraries could not use it under `RN_STRICT_API`, and the bridgeless Android runtime had to depend on the bridge to get it. - Add a header-only `cxxreact:recoverableerror` target. The include path stays `<cxxreact/RecoverableError.h>`; `cxxreact:bridge` re-exports it for existing users. - Move the header from the private tier to "for frameworks" (`FrameworksGuard.h`). - `ReactAndroid`'s `runtime/jni` depends on `cxxreact:recoverableerror` instead of `cxxreact:bridge`. - Remove the unused include from `Instance.cpp`. Changelog: [General][Changed] - Move `RecoverableError` from private headers to "for frameworks" headers Reviewed By: cipolleschi Differential Revision: D124957581 fbshipit-source-id: 647921290590d0b748e80f5161f87879d9c5b808
1 parent 6ff4872 commit f9c7007

5 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎packages/react-native/ReactCommon/cxxreact/Instance.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "MethodCall.h"
1818
#include "NativeToJsBridge.h"
1919
#include "RAMBundleRegistry.h"
20-
#include "RecoverableError.h"
2120
#include "TraceSection.h"
2221

2322
#include <folly/json.h>

‎packages/react-native/ReactCommon/cxxreact/RecoverableError.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/PrivateGuard.h>
10+
#include <react/cxxstableapi/FrameworksGuard.h>
1111

1212
#include <exception>
1313
#include <functional>

‎scripts/cxx-api/api-snapshots/ReactAndroidFrameworksCxx.api‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6438,6 +6438,13 @@ struct facebook::react::ReadableType : public facebook::jni::JavaClass<facebook:
64386438
public static jni::alias_ref<facebook::react::ReadableType> getType(folly::dynamic::Type type);
64396439
}
64406440

6441+
struct facebook::react::RecoverableError : public std::exception {
6442+
public RecoverableError(const std::string& what_);
6443+
public virtual const char* what() const noexcept override;
6444+
template <typename E>
6445+
public static void runRethrowingAsRecoverable(std::function<void()> act);
6446+
}
6447+
64416448
struct facebook::react::Rect {
64426449
public bool containsPoint(facebook::react::Point point) noexcept;
64436450
public bool operator==(const facebook::react::Rect& rhs) const noexcept = default;

‎scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8464,6 +8464,13 @@ struct facebook::react::ReactNativeVersionType {
84648464
public std::string_view Prerelease;
84658465
}
84668466

8467+
struct facebook::react::RecoverableError : public std::exception {
8468+
public RecoverableError(const std::string& what_);
8469+
public virtual const char* what() const noexcept override;
8470+
template <typename E>
8471+
public static void runRethrowingAsRecoverable(std::function<void()> act);
8472+
}
8473+
84678474
struct facebook::react::Rect {
84688475
public bool containsPoint(facebook::react::Point point) noexcept;
84698476
public bool operator==(const facebook::react::Rect& rhs) const noexcept = default;

‎scripts/cxx-api/api-snapshots/ReactCommonFrameworksCxx.api‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4620,6 +4620,13 @@ struct facebook::react::ReactNativeVersionType {
46204620
public std::string_view Prerelease;
46214621
}
46224622

4623+
struct facebook::react::RecoverableError : public std::exception {
4624+
public RecoverableError(const std::string& what_);
4625+
public virtual const char* what() const noexcept override;
4626+
template <typename E>
4627+
public static void runRethrowingAsRecoverable(std::function<void()> act);
4628+
}
4629+
46234630
struct facebook::react::Rect {
46244631
public Float getMaxX() const noexcept;
46254632
public Float getMaxY() const noexcept;

0 commit comments

Comments
 (0)