Allow arbitrary values in ReactCxxPlatform NativeExceptionsManager extraData#57586
Closed
javache wants to merge 1 commit into
Closed
Allow arbitrary values in ReactCxxPlatform NativeExceptionsManager extraData#57586javache wants to merge 1 commit into
javache wants to merge 1 commit into
Conversation
…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
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112388436. |
|
This pull request has been merged in b33de75. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
The JS-side
ExceptionData.extraDatafield is spec'd as?Object— anarbitrarily-nested plain object whose values can be numbers, sub-objects,
arrays, etc. Callers routinely populate it that way:
ExceptionsManager.jsadds
jsEngine/rawStackplus Hermes-stylestackSymbols/stackReturnAddresses/stackElements, decorators can attachjsBuildas a number, and anyErrorwith a decoratedRN$ErrorExtraDataKeymay contribute nested objects.The ReactCxxPlatform NativeExceptionsManager modeled that field as
std::optional<std::unordered_map<std::string, std::string>>, forcing everyvalue 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 StringbeforereportExceptioneven ran, so the JS.catchhandler that issued thereport unwound its remaining synchronous work — including any
onCompletecallback that follows the report call.
Relax the C++ spec to
std::optional<folly::dynamic>to match the JS?Objecttype.reportExceptiondoesn't currently forwardextraDatainto the JsErrorHandler, so no downstream code needs updating.
Changelog: [Internal]
Differential Revision: D112388436