Comparing version 3.0.0 to 3.1.0
@@ -31,7 +31,12 @@ "use strict"; | ||
function unhideErrorProperties(err) { | ||
return _.extend( | ||
err = _.extend( | ||
Object.create(Object.getPrototypeOf(err)), | ||
err, | ||
_.pick(err, [ 'name', 'message', 'description', 'number', 'fileName', 'lineNumber', 'columnNumber', ]) | ||
_.pick(err, [ 'name', 'message', 'description', 'number', 'fileName', 'lineNumber', 'columnNumber', 'cause' ]) | ||
); | ||
if (_.isError(err.cause)) { | ||
err.cause = unhideErrorProperties(err.cause); | ||
} | ||
return err; | ||
} | ||
@@ -38,0 +43,0 @@ |
@@ -5,3 +5,3 @@ MIT License | ||
``` | ||
Copyright (C) 2015-2021 SSi Canada and other contributors. | ||
Copyright (C) 2015-2022 SSi Canada and other contributors. | ||
@@ -8,0 +8,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "logformat", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "stringify objects into searchable strings", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -141,2 +141,8 @@ "use strict"; | ||
}); | ||
it('should log Error .cause', () => { | ||
const cause = new Error('bad credentials') | ||
const err = new Error('could not connect to db', { cause }); | ||
expect(logformat(err)).to.contain('bad credentials'); | ||
expect(logformat(err)).to.contain('could not connect'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14416
216