Skip to content

Commit

Permalink
Allow Promise to display error strings and not just error objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelambert committed Sep 20, 2016
1 parent 04392f2 commit 215a41b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Libraries/Promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`) +
Expand Down

0 comments on commit 215a41b

Please sign in to comment.