Skip to content

Remove stack traces from production errors. - #87

Merged
raymondfeng merged 1 commit into
strongloop:masterfrom
STRML:noStack
Jul 28, 2014
Merged

Remove stack traces from production errors.#87
raymondfeng merged 1 commit into
strongloop:masterfrom
STRML:noStack

Conversation

@STRML

Copy link
Copy Markdown
Member

No description provided.

@bajtos

Copy link
Copy Markdown
Member

While this is a good short-term solution, it would be better to provide a configuration option so that users can use different means to turn off stack traces.

@bajtos

Copy link
Copy Markdown
Member

Never mind, Raymond have already commented in the same spirit :)

@bajtos

Copy link
Copy Markdown
Member

BTW accessing the stack trace is AFAIK expensive operation, as the .stack property is lazily evaluated on the first access. This code may perform better:

varstackEnabled=process.env.NODE_ENV!=='production';for(varpropinerr){if(prop==='stack'&&!stackEnabled)continue;data[prop]=err[prop];}if(!stackEnabled){// by default, Error.stack is non-enumerabledata.stack=err.stack;}

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@STRML@bajtos@raymondfeng