Skip to content

Commit

Permalink
fix(core): return proper Error objects from native (#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdiacono authored and jcesarmobile committed Sep 30, 2019
1 parent 6e0d8ba commit 2fa29e3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/native-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@
if (storedCall) {
// looks like we've got a stored call

if (result.error && typeof result.error === 'object') {
// ensure stacktraces by copying error properties to an Error
result.error = Object.keys(result.error).reduce(function(err, key) {
err[key] = result.error[key];
return err;
}, new Error());
}

if (typeof storedCall.callback === 'function') {
// callback
if (result.success) {
Expand Down

0 comments on commit 2fa29e3

Please sign in to comment.