Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bunyan

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan - npm Package Compare versions

Comparing version 0.14.4 to 0.14.5

crash.js

13

CHANGES.md
# bunyan Changelog
## bunyan 0.14.5
- Fix a bug in the long-stack-trace error serialization added in 0.14.4. The
symptom:
bunyan@0.14.4: .../node_modules/bunyan/lib/bunyan.js:1002
var ret = ex.stack || ex.toString();
^
TypeError: Cannot read property 'stack' of undefined
at getFullErrorStack (.../node_modules/bunyan/lib/bunyan.js:1002:15)
...
## bunyan 0.14.4

@@ -4,0 +17,0 @@

10

lib/bunyan.js

@@ -7,3 +7,3 @@ /*

var VERSION = '0.14.4';
var VERSION = '0.14.5';

@@ -1004,4 +1004,8 @@ // Bunyan log format version. This becomes the 'v' field on all log records.

var ret = ex.stack || ex.toString();
if (ex.cause && typeof(ex.cause) === 'function')
ret += '\nCaused by: ' + getFullErrorStack(ex.cause());
if (ex.cause && typeof(ex.cause) === 'function') {
var cex = ex.cause();
if (cex) {
ret += '\nCaused by: ' + getFullErrorStack(cex);
}
}
return (ret);

@@ -1008,0 +1012,0 @@ }

{
"name": "bunyan",
"version": "0.14.4",
"version": "0.14.5",
"description": "a JSON Logger library for node.js services",

@@ -20,3 +20,4 @@ "author": "Trent Mick <trentm@gmail.com> (http://trentm.com)",

"tap": "0.2.0",
"ben": "0.0.0"
"ben": "0.0.0",
"verror": "1.3.3"
},

@@ -23,0 +24,0 @@

@@ -8,6 +8,8 @@ /*

var test = require('tap').test;
var bunyan = require('../lib/bunyan');
var http = require('http');
var bunyan = require('../lib/bunyan');
var verror = require('verror');
function CapturingStream(recs) {

@@ -172,1 +174,83 @@ this.recs = recs;

});
test('err serializer: long stack', function (t) {
var records = [];
var log = bunyan.createLogger({
name: 'serializer-test',
streams: [{
stream: new CapturingStream(records),
type: 'raw'
}],
serializers: {
err: bunyan.stdSerializers.err
}
});
var topErr, midErr, bottomErr;
// Just a VError.
topErr = new verror.VError('top err');
log.info(topErr, 'the error');
var lastRecord = records[records.length-1];
t.equal(lastRecord.err.message, topErr.message);
t.equal(lastRecord.err.name, topErr.name);
t.equal(lastRecord.err.stack, topErr.stack);
// Just a WError.
topErr = new verror.WError('top err');
log.info(topErr, 'the error');
var lastRecord = records[records.length-1];
t.equal(lastRecord.err.message, topErr.message);
t.equal(lastRecord.err.name, topErr.name);
t.equal(lastRecord.err.stack, topErr.stack);
// WError <- TypeError
bottomErr = new TypeError('bottom err');
topErr = new verror.WError(bottomErr, 'top err');
log.info(topErr, 'the error');
var lastRecord = records[records.length-1];
t.equal(lastRecord.err.message, topErr.message);
t.equal(lastRecord.err.name, topErr.name);
var expectedStack = topErr.stack + '\nCaused by: ' + bottomErr.stack;
t.equal(lastRecord.err.stack, expectedStack);
// WError <- WError
bottomErr = new verror.WError('bottom err');
topErr = new verror.WError(bottomErr, 'top err');
log.info(topErr, 'the error');
var lastRecord = records[records.length-1];
t.equal(lastRecord.err.message, topErr.message);
t.equal(lastRecord.err.name, topErr.name);
var expectedStack = topErr.stack + '\nCaused by: ' + bottomErr.stack;
t.equal(lastRecord.err.stack, expectedStack);
// WError <- WError <- TypeError
bottomErr = new TypeError('bottom err');
midErr = new verror.WError(bottomErr, 'mid err');
topErr = new verror.WError(midErr, 'top err');
log.info(topErr, 'the error');
var lastRecord = records[records.length-1];
t.equal(lastRecord.err.message, topErr.message);
t.equal(lastRecord.err.name, topErr.name);
var expectedStack = (topErr.stack
+ '\nCaused by: ' + midErr.stack
+ '\nCaused by: ' + bottomErr.stack);
t.equal(lastRecord.err.stack, expectedStack);
// WError <- WError <- WError
bottomErr = new verror.WError('bottom err');
midErr = new verror.WError(bottomErr, 'mid err');
topErr = new verror.WError(midErr, 'top err');
log.info(topErr, 'the error');
var lastRecord = records[records.length-1];
t.equal(lastRecord.err.message, topErr.message);
t.equal(lastRecord.err.name, topErr.name);
var expectedStack = (topErr.stack
+ '\nCaused by: ' + midErr.stack
+ '\nCaused by: ' + bottomErr.stack);
t.equal(lastRecord.err.stack, expectedStack);
t.end();
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc