0.0.10 • Published 4 years ago

@momsfriendlydevco/crash v0.0.10

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

@MomsFriendlyDevCo/Crash

Nicer error reporting with colors and blackboxing.

var crash = require('@momsfriendlydevco/crash');

crash.trace(new Error('Nope!'));

API

crash.trace(error, options)

Output an error or string with colors and stack tracing.

crash.generate(error, options)

Shorthand function for calling trace with {output: false} as a default option. Use this if only the raw text (ANSI wrapped if {colors: true}) is required but not to be immediately output to STDERR.

crash.stop(error, options)

Similar to crash.trace() but immediately terminate the process, halting all execution

crash.decode(error, options)

Decode a string stack trace into its component parts.

crash.defaults

Default options when rendering.

Valid options are:

OptionTypeDefaultDescription
loggerfunctionconsole.warnActual outputter, used when writing the error
prefixstring"ERROR"Prefix string used when outputting the error
colorsobject or booleanSee codeLookup object of colors used for each part of an error message. If falsy all colors (and ANSI output) is disabled
textobjectSee codeVarious text strings used in error messages
paddingobjectSee codeVarious text padding options
ignorePathsRegExpSee codePath RegExps to blackbox (remove from trace output)
filterUnknownbooleantrueFilter out grarbage stack trace lines
parsersarray <Object>See codeCollection of parsers, which are executed in order until one matches
supportBabelbooleantrueAdd support for decoding Babel parser errors
contextobjectSee belowOptions for configuring code-showing context (preview lines of code)
context.abovebooleantrueShow an indicator above the target line
context.belowbooleantrueShow an indicator below the target line
context.linesBeforenumber1How many lines before the target line to output when showing context
context.linesAfternumber1How many lines after the target line to output when showing context
context.pathRewritefunctionpath => pathHow to mangle the input file path before reading it to show context
0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.6

4 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago