diff options
author | Kamran Khan <kamran.khan@mongodb.com> | 2015-09-16 15:25:07 -0400 |
---|---|---|
committer | Kamran Khan <kamran.khan@mongodb.com> | 2015-09-16 15:25:07 -0400 |
commit | b4c5275fa3de87d63ef408fdcdca66db420c3306 (patch) | |
tree | 09a158c73c62fd5de0a63c5b4333ffb425b6905f /jstests/concurrency/fsm_libs | |
parent | c1b0712f62788ef7b8f397343cb91b73259e20b1 (diff) | |
download | mongo-b4c5275fa3de87d63ef408fdcdca66db420c3306.tar.gz |
SERVER-20431 Prepend error messages to stack traces in concurrency suite
This change makes SpiderMonkey stack traces look more like v8 stack traces,
which automatically include error messages in the 'stack' property.
Diffstat (limited to 'jstests/concurrency/fsm_libs')
-rw-r--r-- | jstests/concurrency/fsm_libs/runner.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/jstests/concurrency/fsm_libs/runner.js b/jstests/concurrency/fsm_libs/runner.js index 5d6e50339c0..452199587aa 100644 --- a/jstests/concurrency/fsm_libs/runner.js +++ b/jstests/concurrency/fsm_libs/runner.js @@ -281,13 +281,9 @@ var runner = (function() { if (workerErrs.length > 0) { var stackTraces = workerErrs.map(function(e) { - if (e.err && e.stack) { - // Prepend the error message to the stack trace because it - // isn't automatically included in SpiderMonkey stack traces - // (see: SERVER-18781). - return e.err + '\n\n' + e.stack; - } - return e.stack || e.err; + // Prepend the error message to the stack trace because it + // isn't automatically included in SpiderMonkey stack traces. + return e.err + '\n\n' + e.stack; }); var err = new Error(prepareMsg(stackTraces) + '\n'); @@ -296,8 +292,9 @@ var runner = (function() { var maxLogLine = 10 * 1024; // 10KB // Check if the combined length of the error message and the stack traces - // exceeds the maximum line-length the shell will log - if (err.stack.length >= maxLogLine) { + // exceeds the maximum line-length the shell will log. + if ((err.message.length + err.stack.length) >= maxLogLine) { + print(err.message); print(err.stack); throw new Error('stack traces would have been snipped, see logs'); } @@ -430,7 +427,11 @@ var runner = (function() { try { teardownWorkload(workload, context, cluster); } catch (err) { - print('Workload teardown function threw an exception:\n' + err.stack); + // Prepend the error message to the stack trace because it + // isn't automatically included in SpiderMonkey stack traces. + var message = err.message + '\n\n' + err.stack; + + print('Workload teardown function threw an exception:\n' + message); teardownFailed = true; } }); |