pretty-error icon indicating copy to clipboard operation
pretty-error copied to clipboard

Document .stop() / a way to obtain unmodified stack traces

Open apopescu-im opened this issue 5 years ago • 1 comments

I had an issue where I needed to obtain an un-modified stack trace for another package to parse information out of. In the end I solved it as:

pe.stop();
const stack = (new Error()).stack;
pe.start();

It took some digging and intuition to find .stop() so it would be helpful if this was mentioned in the readme.

The reason I didn't individually format errors instead of .start() is that I have many places where errors may be output, but only one where I need this raw trace.

Question: Is the original .stack stored anywhere? I think it would be great to be able to access it, as well as the ParsedError (to eliminate the need for other parsing packages since the message is parsed once here anyway)

apopescu-im avatar Aug 29 '18 17:08 apopescu-im