Generic error class for Firescript

Usage no npm install needed!

<script type="module">
  import firescriptError from '';


Firescript Error

Error base class for Firescript

import FirescriptError from 'firescript-error'

export class MyError extends FirescriptError
    constructor (...args)
        super(...args) = 'MyError'
        this.code = 'MY_ERR_CODE'

.from(obj err)

Create FirescriptError styled error from an error object

    # some error happens
catch err
    throw FirescriptError.from(err)


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