Stack traces in JSON format.
npm install stack-json
;console;// All error objects contain the stackJSON property.
The property is lazy-loaded and as such does not harm the performance of your production code. However generating the JSON stack trace can take a while (not very long, but it is looking up files synchronously, if not already cached).
Since the module use stack-chain to do the stack trace magic, you can use it together with other modules that provides stack trace features. For example you can use it with trace, which gives you a nice long stack trace in asynchronous code (mainly when debugging):
;; // load it after this module;
You can create your own formatted stack traces. This is the technique that stack-formatted use. Here is a short example:
The package information in each stack frame (the
pkg property) is gathered using the package-lookup module.