From ba02ae7f8dca794032959c62f72603b2f7814e68 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 19 Oct 2016 21:21:00 -0700 Subject: Improved error handling --- ext/fg/js/driver.js | 10 ++++++++++ ext/fg/js/util.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'ext/fg/js') diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js index 75dbe219..9aab7950 100644 --- a/ext/fg/js/driver.js +++ b/ext/fg/js/driver.js @@ -163,6 +163,8 @@ class Driver { return true; }); } + }).catch(error => { + alert('Error: ' + error); }); } @@ -202,6 +204,8 @@ class Driver { return true; }); } + }).catch(error => { + alert('Error: ' + error); }); } @@ -231,6 +235,8 @@ class Driver { } }); } + }).catch(error => { + alert('Error: ' + error); }); } @@ -273,6 +279,8 @@ class Driver { } else { alert('Note could not be added'); } + }).catch(error => { + alert('Error: ' + error); }); } @@ -317,6 +325,8 @@ class Driver { states.forEach((state, index) => this.popup.invokeApi('setActionState', {index, state, sequence})); } }); + }).catch(error => { + alert('Error: ' + error); }); } } diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index 7248ae86..6f2fd28d 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -19,7 +19,7 @@ function invokeApiBg(action, params) { return new Promise((resolve, reject) => { - chrome.runtime.sendMessage({action, params}, (result, error) => { + chrome.runtime.sendMessage({action, params}, ({result, error}) => { if (error) { reject(error); } else { -- cgit v1.2.3