From fdeae6bdf694a4c6ee510d94d3ae0728c635f413 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 18 Apr 2016 18:42:58 +0100 Subject: [PATCH] Display web3 encoding error (if arguments are not supplied by the user, etc.) --- assets/js/universal-dapp.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/js/universal-dapp.js b/assets/js/universal-dapp.js index a7b74a0238..25be51d43d 100644 --- a/assets/js/universal-dapp.js +++ b/assets/js/universal-dapp.js @@ -287,8 +287,14 @@ UniversalDApp.prototype.getCallButton = function(args) { return; } var data = ''; - if (!isConstructor || funArgs.length > 0) - data = args.encode(funArgs); + if (!isConstructor || funArgs.length > 0) { + try { + data = args.encode(funArgs); + } catch(e) { + replaceOutput($result, $('').text('Error encoding arguments: ' + e)); + return; + } + } if (data.slice(0, 9) == 'undefined') data = data.slice(9); if (data.slice(0, 2) == '0x') data = data.slice(2);