Skip to content

Allow arbitrary values in ReactCxxPlatform NativeExceptionsManager extraData#57586

Closed
javache wants to merge 1 commit into
react:mainfrom
javache:export-D112388436
Closed

Allow arbitrary values in ReactCxxPlatform NativeExceptionsManager extraData#57586
javache wants to merge 1 commit into
react:mainfrom
javache:export-D112388436

Conversation

@javache

@javache javache commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary:
The JS-side ExceptionData.extraData field is spec'd as ?Object — an
arbitrarily-nested plain object whose values can be numbers, sub-objects,
arrays, etc. Callers routinely populate it that way: ExceptionsManager.js
adds jsEngine/rawStack plus Hermes-style
stackSymbols/stackReturnAddresses/stackElements, decorators can attach
jsBuild as a number, and any Error with a decorated
RN$ErrorExtraDataKey may contribute nested objects.

The ReactCxxPlatform NativeExceptionsManager modeled that field as
std::optional<std::unordered_map<std::string, std::string>>, forcing every
value to be a string. As soon as a caller included a non-string value the
JSI bridging layer threw Value is an object, expected a String before
reportException even ran, so the JS .catch handler that issued the
report unwound its remaining synchronous work — including any onComplete
callback that follows the report call.

Relax the C++ spec to std::optional<folly::dynamic> to match the JS
?Object type. reportException doesn't currently forward extraData
into the JsErrorHandler, so no downstream code needs updating.

Changelog: [Internal]

Differential Revision: D112388436

…traData

Summary:
The JS-side `ExceptionData.extraData` field is spec'd as `?Object` — an
arbitrarily-nested plain object whose values can be numbers, sub-objects,
arrays, etc. Callers routinely populate it that way: `ExceptionsManager.js`
adds `jsEngine`/`rawStack` plus Hermes-style
`stackSymbols`/`stackReturnAddresses`/`stackElements`, decorators can attach
`jsBuild` as a number, and any `Error` with a decorated
`RN$ErrorExtraDataKey` may contribute nested objects.

The ReactCxxPlatform NativeExceptionsManager modeled that field as
`std::optional<std::unordered_map<std::string, std::string>>`, forcing every
value to be a string. As soon as a caller included a non-string value the
JSI bridging layer threw `Value is an object, expected a String` *before*
`reportException` even ran, so the JS `.catch` handler that issued the
report unwound its remaining synchronous work — including any `onComplete`
callback that follows the report call.

Relax the C++ spec to `std::optional<folly::dynamic>` to match the JS
`?Object` type. `reportException` doesn't currently forward `extraData`
into the JsErrorHandler, so no downstream code needs updating.

Changelog: [Internal]

Differential Revision: D112388436
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 16, 2026
@meta-codesync

meta-codesync Bot commented Jul 16, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112388436.

@meta-codesync meta-codesync Bot closed this in b33de75 Jul 16, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jul 17, 2026
@meta-codesync

meta-codesync Bot commented Jul 17, 2026

Copy link
Copy Markdown

This pull request has been merged in b33de75.

@javache
javache deleted the export-D112388436 branch July 21, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant