firescript-error

1.2.0 • Public • Published

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

Dependents (5)

Package Sidebar

Install

npm i firescript-error

Weekly Downloads

6

Version

1.2.0

License

MIT

Unpacked Size

19.9 kB

Total Files

5

Last publish

Collaborators

  • firetux