Trim exception stack trace in faults
This commit is contained in:
1 parent
12aa43c379
commit
c940bba4a3
2 files changed
+6
-3
No files matched your search
+2
-2
@@ -192,7 +192,7 @@ refresh = (callback) ->
|
|||||||
for r in res
|
for r in res
|
||||||
provisions[r._id] = {}
|
provisions[r._id] = {}
|
||||||
provisions[r._id].md5 = crypto.createHash('md5').update(r.script).digest('hex')
|
provisions[r._id].md5 = crypto.createHash('md5').update(r.script).digest('hex')
|
||||||
provisions[r._id].script = new vm.Script("\"use strict\";(function(){\n#{r.script}\n})();", {filename: r._id, lineOffset: 1, timeout: 50})
|
provisions[r._id].script = new vm.Script("\"use strict\";(function(){\n#{r.script}\n})();", {filename: r._id, lineOffset: -1, timeout: 50})
|
||||||
|
|
||||||
if (counter -= 2) == 1
|
if (counter -= 2) == 1
|
||||||
computeHash()
|
computeHash()
|
||||||
@@ -213,7 +213,7 @@ refresh = (callback) ->
|
|||||||
for r in res
|
for r in res
|
||||||
virtualParameters[r._id] = {}
|
virtualParameters[r._id] = {}
|
||||||
virtualParameters[r._id].md5 = crypto.createHash('md5').update(r.script).digest('hex')
|
virtualParameters[r._id].md5 = crypto.createHash('md5').update(r.script).digest('hex')
|
||||||
virtualParameters[r._id].script = new vm.Script("\"use strict\";(function(){\n#{r.script}\n})();", {filename: r._id, lineOffset: 1, timeout: 50})
|
virtualParameters[r._id].script = new vm.Script("\"use strict\";(function(){\n#{r.script}\n})();", {filename: r._id, lineOffset: -1, timeout: 50})
|
||||||
|
|
||||||
if (counter -= 2) == 1
|
if (counter -= 2) == 1
|
||||||
computeHash()
|
computeHash()
|
||||||
|
|||||||
+4
-1
@@ -224,13 +224,16 @@ function errorToFault(err) {
|
|||||||
if (!err)
|
if (!err)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
// Trim the stack trace at the self-executing anonymous wrapper function
|
||||||
|
let stackTrimIndex = err.stack.match(/\s+at\s[^\s]+\s+at\s[^\s]+\s\(vm\.js.+\)/).index;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code: `script.${err.name}`,
|
code: `script.${err.name}`,
|
||||||
message: err.message,
|
message: err.message,
|
||||||
detail: {
|
detail: {
|
||||||
name: err.name,
|
name: err.name,
|
||||||
message: err.message,
|
message: err.message,
|
||||||
stack: err.stack
|
stack: err.stack.slice(0, stackTrimIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user