Minimal library for parsing and printing node stacktrace. Mostly for use in express-error-with-sources.
npm install --save parsetrace
var parsetrace = ;trythrow 'My cool error';catch econsole;
Parses stack trace from
object, that have
If callback is passed - all source code fetching will be async and error will be passed to it (even if
sources- fetch source code from files, that are mentioned in stacktrace. If file can not be found or readed - sources will be fetched silently (unless you enabled
strict- throws errors, while parsing stacktrace and fetching source code (default:
contextSize- number of lines before and after the error line (default:
Object with methods described below:
Returns stacktrace as Json string
Format of object you can see in
Returns stacktrace as Object
excludeSources- if stacktrace was parsed with sources, this will exclude them from output (default:
Returns stacktrace as NodeJS formatted stacktracke string.