cli-error-handler

1.0.3 • Public • Published

cli-error-handler

Error handler for nodeJs.


📟

Install

npm install cli-error-handler

⚙️

Usage

const handleError = require('cli-error-handler');

// Let's say we get an error message from a custom command.
const [err, res] = await somePromise();

// Use the function. It will print the error and exit if there is an error.
handleError(`Failed while building on step #1`, err);

📃

API

handleError(heading, err, displayError?, exit?)

❯ heading

Type: string

Heading of the error message.

❯ err

Type: error/object

❯ displayError

Type: boolean
Default: true (optional)

Display the error message or not.

❯ exit

Type: boolean
Default: true (optional)

Exit the CLI on error or not?


Connect

GitHub @tawseefnabi (follow) To stay up to date on free & open-source software

Twitter @NabiTowseef (follow) To get tech updates/small>

LinkedIn @MrAhmadAwais (connect) On the LinkedIn profile y'all


Readme

Keywords

Package Sidebar

Install

npm i cli-error-handler

Weekly Downloads

108

Version

1.0.3

License

MIT

Unpacked Size

3.8 kB

Total Files

3

Last publish

Collaborators

  • tos_