diff --git a/packages/react-native/ReactCxxPlatform/react/logging/NativeExceptionsManager.h b/packages/react-native/ReactCxxPlatform/react/logging/NativeExceptionsManager.h index 4dba94aa3f0a..9e8d49ac8c2f 100644 --- a/packages/react-native/ReactCxxPlatform/react/logging/NativeExceptionsManager.h +++ b/packages/react-native/ReactCxxPlatform/react/logging/NativeExceptionsManager.h @@ -8,11 +8,11 @@ #pragma once #include +#include #include #include #include #include -#include #include #include @@ -29,6 +29,11 @@ using StackFrame = NativeExceptionsManagerStackFrame< template <> struct Bridging : NativeExceptionsManagerStackFrameBridging {}; +// extraData is `?Object` on the JS side and callers routinely populate it with +// non-string values (e.g. jsBuild as a number, nested Error-decorated objects +// via RN$ErrorExtraDataKey). A flat unordered_map would fail +// bridging with "Value is an object, expected a String" before reportException +// runs. using ExceptionData = NativeExceptionsManagerExceptionData< std::string, std::optional, @@ -37,7 +42,7 @@ using ExceptionData = NativeExceptionsManagerExceptionData< std::vector, int32_t, bool, - std::optional>>; + std::optional>; template <> struct Bridging : NativeExceptionsManagerExceptionDataBridging {};