aboutsummaryrefslogtreecommitdiff
path: root/lib/compile-handler.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compile-handler.js')
-rw-r--r--lib/compile-handler.js13
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}]}));
}