Providing better stack traces for V8 by giving you full-fledged objects for each frame in the trace.
Creating a nice color trace with context, reversed so that the latest call is printed last:
var trace = trace;try;catcherrvar stacktrace = ;console;
Iterating through frames and grabbing the constituent files:
var trace = trace;try;catcherrvar stacktrace = ;forvar i = 0 len = stacktraceframeslength; i < len; ++iconsole;
Creates and returns a
Trace object by parsing an
Holds the original error, the first line of the trace (the message), and the frames that make up the stack trace. Returned by
first_line: the first line of the original stack trace -- usually contains the error message, if any.
original_error: the original
Errorobject that the
Tracewas generated from.
The default output of
Trace#toString looks like the following:
The default printing mode for the trace; an array of
Defaults to two lines of context with a cursor, with the character that caused the error appearing red.
Returns the prettified stack trace as a string, using
reversed defaults to
true, meaning the most recent call is displayed last. The remaining arguments are passed to
Frame#toString for each frame in
Contains information about a specific stack frame.
named_location: The name of the scope where the frame originated; e.g.,
filename: The filename of the frame.
line: The integer line number of the frame.
character: The character at which the error occurred in the line of the frame.
Returns a string containing the text of the file the frame originated from. Works on both native modules as well as userland modules. Cached and synchronous.
Wraps the output from
Frame#get_lines() with information about the file, line number, character, and scope if available.
Returns a string containing
context lines surrounding the error line from the file of this frame. If
true, it will
> at the line where the error occurred, and a space before all other lines.
highlight_error_start can be any value that ansi-colors will accept, or false to avoid highlighting the character.