react-native icon indicating copy to clipboard operation
react-native copied to clipboard

fix: android native rejections should be instanceof Error

Open vonovak opened this issue 1 year ago • 3 comments

Summary:

closes #44050

I'm not familiar with the internals so not sure if this is the right fix because it feels there could / should be some different flow for errors.. but here it is anyways. The important part of the fix is there and can be taken over by someone (I don't have the bandwidth to finish soon).

The code I changed is called from https://github.com/facebook/react-native/blob/78d523d178268bbeb8645c272326ac3d715fa79a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java#L231

I'll fill out more information later

Changelog:

Test Plan:

tested locally

vonovak avatar Apr 11 '24 22:04 vonovak

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,385,135 +16,350
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,760,097 +16,380
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 3d0054939929608d317dc1e75a21dd20b9930eda Branch: main

analysis-bot avatar Apr 11 '24 22:04 analysis-bot

This is using heuristics (the presence of various keys) to make assumptions about what is an error. This is a performance cost for every callback into JS and a maintenance burden. If we want to report errors as Errors we need a specific codepath here that starts at the Java side.

javache avatar Apr 12 '24 09:04 javache

Yep, that's what I figured. Happy to do it differently if I'm told how, but feel free to close this (maybe that's easiest)👍

vonovak avatar Apr 12 '24 11:04 vonovak

hey, I won't have time to make a proper fix, so I'm closing

vonovak avatar Apr 25 '24 15:04 vonovak