Skip to content

Commit

Permalink
fix(stacktrace): fatalException wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelyke committed Sep 5, 2015
1 parent 9606c38 commit 50150f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/wraps/process._fatalException.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
var getNamespace = require('continuation-local-storage').getNamespace;
var microtime = require('microtime');

function wrapRequest (original, collector) {
function wrap(original, collector) {
var session = getNamespace('trace');

return session.bind(function (stackTrace) {
return function (stackTrace) {
collector.onCrash({
id: session.get('request-id'),
time: microtime.now(),
stackTrace: stackTrace.stack
});

return original.apply(this, arguments);
});
};
}

module.exports = wrapRequest;
module.exports = wrap;
2 changes: 1 addition & 1 deletion lib/wraps/process._fatalException.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('The process._fatalException wrapper module', function () {
expect(err).to.be.not.ok;
expect(raw).to.be.ok;

var stacktrace = JSON.parse(raw.slice(0, -2)).events[0];
var stacktrace = JSON.parse(raw.slice(0, -2)).events[1];

expect(stacktrace.type).to.be.eq('st');

Expand Down

0 comments on commit 50150f8

Please sign in to comment.