1.2.0 • Published 4 years ago
firescript-error
Licence
MIT
Version
1.2.0
Deps
0
Size
19 kB
Vulns
0
Weekly
0
Firescript Error
Error base class for Firescript
import FirescriptError from 'firescript-error'
export class MyError extends FirescriptError
constructor (...args)
super(...args)
this.name = 'MyError'
this.code = 'MY_ERR_CODE'
.from(obj err)
Create FirescriptError styled error from an error object
try
# some error happens
catch err
throw FirescriptError.from(err)
Colors
Error messages are pretty colorized in the CLI.
The FirescriptError module detects whether the stdout is a tty terminal or not and set the colormode based on this information.
You can control the colormode by setting an env variable called FIRESCRIPT_ERROR_COLORS
export FIRESCRIPT_ERROR_COLORS=1 # enable error colors
export FIRESCRIPT_ERROR_COLORS=0 # disable error colors