diff options
author | Matt Godbolt <matt@godbolt.org> | 2017-02-04 09:20:06 -0600 |
---|---|---|
committer | Matt Godbolt <matt@godbolt.org> | 2017-02-04 09:20:06 -0600 |
commit | 6d2959f8f1f5dd4b0d3716f5c48f92a8ec678cc9 (patch) | |
tree | c1013121b644a2167f665f2e55a12baecd40ed7b /lib/compile-handler.js | |
parent | bafc482f9cbe2cc4585e81b3d7260144b04919b1 (diff) | |
download | compiler-explorer-6d2959f8f1f5dd4b0d3716f5c48f92a8ec678cc9.tar.gz compiler-explorer-6d2959f8f1f5dd4b0d3716f5c48f92a8ec678cc9.zip |
Better error handling
Diffstat (limited to 'lib/compile-handler.js')
-rw-r--r-- | lib/compile-handler.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/compile-handler.js b/lib/compile-handler.js index 9f200f58f..a9679c556 100644 --- a/lib/compile-handler.js +++ b/lib/compile-handler.js @@ -29,6 +29,7 @@ var child_process = require('child_process'), quote = require('shell-quote'), _ = require('underscore-node'), logger = require('./logger').logger, + utils = require('./utils'), CompilationEnvironment = require('./compilation-env').CompilationEnvironment; temp.track(); @@ -163,9 +164,17 @@ function CompileHandler(gccProps, compilerProps) { } }, function (error) { - logger.error("Error: " + error.stack || error); + logger.error("Error", error); if (typeof(error) !== "string") { - error = "Internal Compiler Explorer error: " + error.stack || error; + if (error.code) { + if (typeof(error.stderr) === "string") { + error.stdout = utils.parseOutput(error.stdout); + error.stderr = utils.parseOutput(error.stderr); + } + res.end(JSON.stringify(error)); + return; + } + error = "Internal Compiler Explorer error: " + (error.stack || error); } res.end(JSON.stringify({code: -1, stderr: [{text: error}]})); } |