From 4172a86c171e21b66a15244cf4a2a02d6f1683a9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 21 May 2016 19:22:45 +0100 Subject: [PATCH] Catch JSON parsing errors of the Solidity output Makes the error apparent for https://github.com/chriseth/browser-solidity/issues/114 and https://github.com/chriseth/browser-solidity/issues/132 --- src/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 4dbc311d36..9b7e636aea 100644 --- a/src/app.js +++ b/src/app.js @@ -624,9 +624,16 @@ var run = function() { }); }; var compilationFinished = function(result, missingInputs) { - var data = $.parseJSON(result); + var data; var noFatalErrors = true; // ie warnings are ok + try { + data = $.parseJSON(result); + } catch (exception) { + renderError('Invalid JSON output from the compiler: ' + exception); + return; + } + if (data['error'] !== undefined) { renderError(data['error']); if (errortype(data['error']) !== 'warning') noFatalErrors = false;