api-error-handler
api-error-handler copied to clipboard
add showStack option
This feature has been requested a few times and attempted in several PRs such as:
#1 #2 #5 #12
Most recently something like this was requested in #11
I read the feedback from other PRs and created one that I think accomplishes the requests I saw there, such as setting the option as a boolean.
While working on this I realized that the production flag internally in the module is set at the time of require, which necessitated some tricky work in the tests. I created two new sets of tests for regression testing of this feature. They clear the require cache for this module before setting the NODE_ENV value, so we can properly test the behavior of hiding/showing stack traces based on the environment.