Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error name omitted from metadata #52

Closed
tlvince opened this issue Aug 18, 2021 · 1 comment · Fixed by #53
Closed

Error name omitted from metadata #52

tlvince opened this issue Aug 18, 2021 · 1 comment · Fixed by #53

Comments

@tlvince
Copy link
Contributor

tlvince commented Aug 18, 2021

What happens?

The name of Error objects is not included in the log metadata. It is omitted as it's a non-enumerable property on Error.prototype, not the instance and so

if(Object.prototype.hasOwnProperty.call(err, key)) {
will always return false.

What were you expecting to happen?

The Error name to be included in metadata

Steps to reproduce

const log = require('lambda-log')
const error = new Error('foo')
log.error('bar', { error })
{
  "_logLevel": "error",
  "msg": "bar",
  "error": {
    "message": "foo",
    "stack": "Error: foo\n    at Object.<anonymous> (/tmp/index.js:436:13)\n    at Module._compile (internal/modules/cjs/loader.js:1072:14)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)\n    at Module.load (internal/modules/cjs/loader.js:937:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:778:12)\n    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)\n    at internal/main/run_main_module.js:17:47"
  },
  "_tags": []
}

Environment

Operating System: Linux
Node Version: 14.17.5
Lambda Log Version: 3.0.0

tlvince added a commit to tlvince/node-lambda-log that referenced this issue Aug 18, 2021
@KyleRoss KyleRoss self-assigned this Sep 27, 2021
github-actions bot pushed a commit that referenced this issue Sep 27, 2021
## [3.0.1](v3.0.0...v3.0.1) (2021-09-27)

### Bug Fixes

* include error name in metadata ([5a1214c](5a1214c)), closes [#52](#52)
@github-actions
Copy link

🎉 This issue has been resolved in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants