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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.05latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.05
1.1.41
1.1.30
1.1.20
1.1.10
1.1.00
1.0.10
1.0.00

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