aboutsummaryrefslogtreecommitdiff
path: root/popup
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-03-02 00:47:00 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-03-02 00:49:10 +0100
commit7c03db9ba0fcbf10da8fc37ff55b6d987aab8541 (patch)
tree396ad80cf28680ff1fe21a9fb60ec4b190899464 /popup
parentff3cea6b64704af2af824b074eadd32a00d2e72e (diff)
downloadwallet-core-7c03db9ba0fcbf10da8fc37ff55b6d987aab8541.tar.xz
db versioning
Diffstat (limited to 'popup')
-rw-r--r--popup/popup.tsx32
1 files changed, 27 insertions, 5 deletions
diff --git a/popup/popup.tsx b/popup/popup.tsx
index 2cd753e4f..be33f870a 100644
--- a/popup/popup.tsx
+++ b/popup/popup.tsx
@@ -95,6 +95,7 @@ namespace WalletBalance {
class Controller {
myWallet;
+ gotError = false;
constructor() {
this.updateBalance();
@@ -104,9 +105,16 @@ namespace WalletBalance {
updateBalance() {
m.startComputation();
- chrome.runtime.sendMessage({type: "balances"}, (wallet) => {
- console.log("got wallet", wallet);
- this.myWallet = wallet;
+ chrome.runtime.sendMessage({type: "balances"}, (resp) => {
+ if (resp.error) {
+ this.gotError = true;
+ console.error("could not retrieve balances", resp);
+ m.endComputation();
+ return;
+ }
+ this.gotError = false;
+ console.log("got wallet", resp);
+ this.myWallet = resp.balances;
m.endComputation();
});
}
@@ -114,6 +122,9 @@ namespace WalletBalance {
export function view(ctrl: Controller) {
let wallet = ctrl.myWallet;
+ if (ctrl.gotError) {
+ return i18n`Error: could not retrieve balance information.`;
+ }
if (!wallet) {
throw Error("Could not retrieve wallet");
}
@@ -200,6 +211,7 @@ namespace WalletHistory {
class Controller {
myHistory;
+ gotError = false;
constructor() {
this.update();
@@ -209,8 +221,15 @@ namespace WalletHistory {
update() {
m.startComputation();
chrome.runtime.sendMessage({type: "get-history"}, (resp) => {
- console.log("got history", history);
- this.myHistory = resp;
+ if (resp.error) {
+ this.gotError = true;
+ console.error("could not retrieve history", resp);
+ m.endComputation();
+ return;
+ }
+ this.gotError = false;
+ console.log("got history", resp.history);
+ this.myHistory = resp.history;
m.endComputation();
});
}
@@ -218,6 +237,9 @@ namespace WalletHistory {
export function view(ctrl: Controller) {
let history = ctrl.myHistory;
+ if (ctrl.gotError) {
+ return i18n`Error: could not retrieve event history`;
+ }
if (!history) {
throw Error("Could not retrieve history");
}