July 2017
Intermediate to advanced
656 pages
16h 1m
English
The default stack trace could definitely stand to be more human friendly.
Enter cute-stack, a tool for creating prettified stack traces.
Let's copy our app folder to pretty-stack-app and install cute-stack:
$ cp -fr app pretty-stack-app $ cd app $ npm install --save cute-stack
Now let's place the following at the very top of the index.js file:
require('cute-stack')()
Now let's run our process with a larger stack trace limit (as in the main recipe),
$ node --stack-trace-limit=21 index.js
Make a request, either with a browser, or if installed, curl:
$ curl http://localhost:3000/
As a result, we should see a beautified stack trace, similar to the following screenshot: