From 8bf30b93b1e09fbbc45c40d5684104009210df56 Mon Sep 17 00:00:00 2001 From: Stefaan Ponnet Date: Thu, 9 Feb 2017 18:56:38 +0100 Subject: [PATCH] fixes #92 #106 --- src/ac-helpers.html | 9 +++++++++ src/ac-profile.html | 2 +- src/ac-swtconversion.html | 3 ++- src/ac-tokenreceive.html | 2 +- src/ac-tokensend.html | 4 ++-- src/ac-vault.html | 8 +++++--- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ac-helpers.html b/src/ac-helpers.html index 98ffc68..8c6acba 100644 --- a/src/ac-helpers.html +++ b/src/ac-helpers.html @@ -72,6 +72,15 @@ }); }, + translateEthErrors: function(err){ + var e = err.toString(); + if (err && err.toString().startsWith('Error: Insufficient gas')){ + return('something went wrong, try again.'); + } + return err; + }, + + }); diff --git a/src/ac-profile.html b/src/ac-profile.html index a7a796f..ddd73eb 100644 --- a/src/ac-profile.html +++ b/src/ac-profile.html @@ -443,7 +443,7 @@ mode="imgonly" size="big" > - + diff --git a/src/ac-swtconversion.html b/src/ac-swtconversion.html index b243aac..09aaa02 100644 --- a/src/ac-swtconversion.html +++ b/src/ac-swtconversion.html @@ -589,7 +589,8 @@

{{formatpong(swtbalance)}}

this.secondstate = 'doing'; this.convertTokens(function(err) { if (err) { - this.secondstateerrormsg = err; + this.secondstateerrormsg = this.$.helpers.translateEthErrors(err); + this.convertingstarted = false; return this.secondstate = 'error'; } this.secondstate = 'succes'; diff --git a/src/ac-tokenreceive.html b/src/ac-tokenreceive.html index 33d119e..8703d18 100644 --- a/src/ac-tokenreceive.html +++ b/src/ac-tokenreceive.html @@ -355,7 +355,7 @@

- Transaction failed {{receivecoinstateerror}}.

+ {{receivecoinstateerror}}

diff --git a/src/ac-tokensend.html b/src/ac-tokensend.html index 8edf90a..e4386fa 100644 --- a/src/ac-tokensend.html +++ b/src/ac-tokensend.html @@ -663,10 +663,10 @@ console.log('tx in error...'); self.$.whisper.whisperpost(self.receiver.from, JSON.stringify({ 'command': 'transfererror', - 'error': err.toString() + 'error': self.$.helpers.translateEthErrors(err) })); self.sendcoinstate = 'transfererror'; - self.transfererrormessage = err; + self.transfererrormessage = self.$.helpers.translateEthErrors(err); } else { diff --git a/src/ac-vault.html b/src/ac-vault.html index 6041efa..b740329 100644 --- a/src/ac-vault.html +++ b/src/ac-vault.html @@ -797,12 +797,13 @@

Great!

if (!file) { return; } + this.walletfilename = file.name; self.uploadingwallet = true; var reader = new FileReader(); - reader.onload = function(e) { - var contents = e.target.result; + reader.onload = function(readere) { + var contents = readere.target.result; //self.readwallet = contents; //window.setTimeout(function(){ self.uploadingwallet = false; @@ -811,7 +812,8 @@

Great!

self.uploadingwallet = false; self.pkshowpassw = true; self.status = 'locked'; -// self.fire('ready'); + // reset file + e.target.value = null; self.set('route.path', '/uploadunlock'); } //},100);