๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

cli-handle-error

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-handle-error

Custom error handler for Node.js CLIs.

4.4.1
latest
Source
npm
Version published
Weekly downloads
64K
-20.06%
Maintainers
0
Weekly downloads
ย 
Created
Source

cli-handle-error

DOWNLOADS Learn VSCode Follow @MrAhmadAwais on Twitter

Custom error handler for Node CLIs


๐Ÿ“Ÿ

Install

npm install node-cli-handle-error

โš™๏ธ

Usage

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

// 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?


๐Ÿ“

Changelog

โฏ Read the changelog here โ†’


KEY: ๐Ÿ“ฆ NEW, ๐Ÿ‘Œ IMPROVE, ๐Ÿ› FIX, ๐Ÿ“– DOC, ๐Ÿš€ RELEASE, and โœ… TEST

I use Emoji-log, you should try it and simplify your git commits.


๐Ÿ“ƒ

License & Conduct


๐Ÿ™Œ

Connect

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

Twitter @MrAhmadAwaisย (follow) To get #OneDevMinute daily hot tips & trolls

YouTube AhmadAwaisย (subscribe) To tech talks & #OneDevMinute videos

Blog: AhmadAwais.comย (read) In-depth & long form technical articles

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


๐Ÿ‘Œ

Sponsor

Me (Ahmad Awais) and my incredible wife (Maedah Batool) are two engineers who fell in love with open source and then with each other. You can read more about me here. If you or your company use any of my projects or like what Iโ€™m doing then consider backing me. I'm in this for the long run. An open-source developer advocate.


Or you can back me by checking out my super fun video course. As developers, we spend over 200 Hrs/month with our code editors โ€” it's only fair to learn your next editor deeply. This course will save you 15-20 hours every month. Become a VSCode Power User โ†’


VSCODE


VSCode Ahmad on Twitter

Keywords

cli-handle-error

FAQs

Package last updated on 27 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts