aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-28 16:21:21 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-28 16:21:21 +0100
commit3c85a0d14ee279d529ab50afa3b375ec41880466 (patch)
tree8b5187d9e39708fdb160838dca5884552ffb22ec
parent7523dcab95f6b5fe0c0f3f8f6b9bede67297bc8a (diff)
error handling
-rw-r--r--src/webex/wxApi.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts
index 1383ffbc3..bb5222a23 100644
--- a/src/webex/wxApi.ts
+++ b/src/webex/wxApi.ts
@@ -85,6 +85,10 @@ async function callBackend<T extends MessageType>(
): Promise<MessageMap[T]["response"]> {
return new Promise<MessageMap[T]["response"]>((resolve, reject) => {
chrome.runtime.sendMessage({ type, detail }, (resp) => {
+ if (chrome.runtime.lastError) {
+ console.log("Error calling backend");
+ reject(new Error(`Error contacting backend: chrome.runtime.lastError.message`));
+ }
if (typeof resp === "object" && resp && resp.error) {
console.warn("response error:", resp)
const e = new WalletApiError(resp.error.message, resp.error);