Skip to content

Commit

Permalink
Merge pull request #56 from tswindell/master
Browse files Browse the repository at this point in the history
Fixing error reporting response in message dispatcher.
  • Loading branch information
stskeeps committed Jul 19, 2019
2 parents d97a99e + ec85b95 commit 264aef5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,17 @@ export class MessageDispatcher {
event.origin)
})
.catch(e => {
event.source.postMessage({
callback: event.data.callback, error: e.toString()
},
event.origin)
try { // Try to send error object, else stringify.
event.source.postMessage({
callback: event.data.callback, error: e
},
event.origin)
} catch (_) {
event.source.postMessage({
callback: event.data.callback, error: e.toString()
},
event.origin)
}
})
}

Expand Down

0 comments on commit 264aef5

Please sign in to comment.