-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add overload for a Promise's Reject method to allow objects/JObject to be sent #730
Comments
@henningms we're just following the lead of what other platforms support for reject (e.g., there is no reject-with-error-object here https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/bridge/Promise.java). You could, in the meantime, "resolve" the promise with the object and then trigger the error path from JavaScript. |
We could do something like this https://github.com/facebook/react-native/blob/d368ebfab2c389cc093f6a73e5c1021408cc6a73/React/Base/RCTUtils.m#L410, which shows how iOS adds a couple extra fields to the JS error object from the NSError, but it doesn't look like it supports and arbitrary custom error object. |
Scratch that last statement, the above link shows how iOS uses the NSError userInfo field (which generally is a dictionary) to support custom fields. I'll look and see how we can support something similar and how/if it's done on Android. |
Looks like it's not supported on Android (probably because Java Throwables do not have the concept of 'userInfo' that's used on iOS). https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java#L58 |
Using System.Exception.Data IDictionary, users can add arbitrary data to a "userInfo" property on the error object. Fixes microsoft#730
Using System.Exception.Data IDictionary, users can add arbitrary data to a "userInfo" property on the error object. Fixes microsoft#730
Using System.Exception.Data IDictionary, users can add arbitrary data to a "userInfo" property on the error object. Fixes #730
In some instances it would be nice to be able to pass along a custom error object in the Reject method for a Promise/IPromise.
The text was updated successfully, but these errors were encountered: