Android: Accept Throwables in Promise.reject()
Summary: public Fixes #4309 This adds the possibility to reject `Promise` instances with `Throwable`s in java, instead of strings. For now, it only reads the message, but we can add more features on top of this, e.g. forwarding the error stack. Reviewed By: andreicoman11 Differential Revision: D2708192 fb-gh-sync-id: ca5ff584eca29370a9f9b780fa9825b17863a7e9
This commit is contained in:
parent
1a748f5ed6
commit
a68c731aca
|
@ -18,5 +18,6 @@ package com.facebook.react.bridge;
|
|||
*/
|
||||
public interface Promise {
|
||||
void resolve(Object value);
|
||||
void reject(Throwable reason);
|
||||
void reject(String reason);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,11 @@ public class PromiseImpl implements Promise {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reject(Throwable reason) {
|
||||
reject(reason.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reject(String reason) {
|
||||
if (mReject != null) {
|
||||
|
|
Loading…
Reference in New Issue