From 2fa29e371e4cb9a86bab01d567358c98a1704363 Mon Sep 17 00:00:00 2001 From: diachedelic Date: Mon, 30 Sep 2019 22:02:40 +1000 Subject: [PATCH] fix(core): return proper Error objects from native (#1950) --- core/native-bridge.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/native-bridge.js b/core/native-bridge.js index 921e61d8a..b49f50375 100644 --- a/core/native-bridge.js +++ b/core/native-bridge.js @@ -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) {