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

Extending Error #514

Open
alien-2-dev opened this issue Jun 22, 2017 · 0 comments
Open

Extending Error #514

alien-2-dev opened this issue Jun 22, 2017 · 0 comments

Comments

@alien-2-dev
Copy link

When extending the Error, and passing it to Bunyan, the new properties are not logged,

Extending Error

class FooError extends Error {

  constructor(message, newPropertyValue) {
    super();
    
    this.message = message;
    this.newProperty = newPropertyValue;
}

When logging

var logger = bunyan.createLogger({name: "myapp"});

var fooError = new FooError("someMessage", "booValue");

logger.error(fooError);

The logs contain "message" as expected but does not include non-standard error properties like the newPropertyValue.

{"name":"myapp","hostname":"localhost.localdomain","pid":16767,"level":50,"err":{"message":"someMessage","name":"Error","stack":"Error: \n   someMessage at ... "},"msg":"someMessage","time":"2017-06-22T13:47:24.774Z","v":0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant