Skip to content

Commit b40ad9d

Browse files
authored
Merge pull request #53 from tlvince/fix/error-name
2 parents 43a32ad + 5a1214c commit b40ad9d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/LogMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class LogMessage {
237237
].concat(Object.keys(err));
238238

239239
return keys.reduce((obj, key) => {
240-
if(Object.prototype.hasOwnProperty.call(err, key)) {
240+
if(key in err) {
241241
const val = err[key];
242242
if(typeof val !== 'function') {
243243
obj[key] = val;

lib/LogMessage.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ describe('Statics', () => {
9999
const result = err.toJSON();
100100

101101
expect(typeof result).toBe('object');
102+
expect(result).toHaveProperty('name', 'Error');
102103
expect(result).toHaveProperty('message', 'test');
103104
expect(result).toHaveProperty('stack', err.stack);
104105
expect(result).toHaveProperty('test', true);

0 commit comments

Comments
 (0)