From 215a41b28a130c3868365a346205bb06270fadfd Mon Sep 17 00:00:00 2001 From: Mike Lambert Date: Mon, 19 Sep 2016 19:16:02 -0400 Subject: [PATCH] Allow Promise to display error strings and not just error objects. --- Libraries/Promise.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/Promise.js b/Libraries/Promise.js index 7b52e135cc33f9..f17650c618119f 100644 --- a/Libraries/Promise.js +++ b/Libraries/Promise.js @@ -17,7 +17,10 @@ if (__DEV__) { require('promise/setimmediate/rejection-tracking').enable({ allRejections: true, onUnhandled: (id, error = {}) => { - const {message = null, stack = null} = error; + let {message = null, stack = null} = error; + if (typeof error === 'string' || error instanceof String) { + message = error; + } const warning = `Possible Unhandled Promise Rejection (id: ${id}):\n` + (message == null ? '' : `${message}\n`) +