node-continuation-local-storage icon indicating copy to clipboard operation
node-continuation-local-storage copied to clipboard

Add option to disable injecting context into error

Open kschat opened this issue 9 years ago • 4 comments

Adds the ability to disable the injection of the current context onto thrown errors.

The motivation behind this is to solve an issue I was having with logging errors when the current context contains an object with circular references. Furthermore, adding properties to error objects feels a little intrusive and there should be a way to disable it if desired.

kschat avatar Jul 07 '16 18:07 kschat

bump

Is this project still being maintained?

kschat avatar Nov 09 '16 23:11 kschat

Not sure I really see much value to this, seems like your error logging should just be filtering properties better. Adding contextual properties onto error objects is very common: many ORM libraries do it, most routing frameworks do it too, even node core adds extra non-standard stuff onto errors.

Qard avatar Nov 12 '16 01:11 Qard

This still allows adding contextual properties to error objects (it even leaves it on by default), it just gives the option to turn it off. We have logging filtering, but I'd prefer if we could remove the context in general.

kschat avatar Nov 12 '16 19:11 kschat

@kschat We had similar issues logging odd 3rd party objects and errors. Here's a gist we used to help keep the objects and errors clean for logging.

Jeff-Lewis avatar Nov 12 '16 23:11 Jeff-Lewis