Package detail

cli-handle-error

ahmadawais277.8kMIT4.4.1

Custom error handler for Node.js CLIs.

cli-handle-error, Ahmad Awais, ahmadawais

readme

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

changelog

CHANGELOG

Twitter @MrAhmadAwais LinkedIn @MrAhmadAwais YouTube AhmadAwais Blog: AhmadAwais.com GitHub @AhmadAwais

I have released a video course to help you build Node.js CLIs for Automation

Support my work: Hey there! If you or your company have been benefiting from any of my projects or simply appreciate the awesomeness I bring to the table, why not consider backing me up? I'm committed to sticking around for the long haul, tirelessly advocating for open-source development.

Sponsor Awais

❯❯ Professional Development Courses ↓

Node CLI Course VSCode Course Node.js Course-gray.svg?colorA=21262D&colorB=30363D&style=for-the-badge)


hr hr


📝

All notable changes in this project's released versions are documented in this file.

CHANGELOG KEY: 📦 NEW, 👌 IMPROVE, 🐛 FIX, 📖 DOC, 🚀 RELEASE, 🤖 TEST, and ‼️ BREAKING.

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



hr hr

RELEASE: 4.4.1

👌 IMPROVE:

👌 tests 9c49883

🐛 FIX:

🐛 Lingo e80b62c



hr hr

RELEASE: 4.4.0

🐛 FIX:

🐛 Warning space ea28fc1

📖 DOC:

📖 Changelog 07db6f0



hr hr

RELEASE: 4.3.0

🐛 FIX:

🐛 Warning space 80993cc

📖 DOC:

📖 Changelog 61a1a45



hr hr

RELEASE: 4.2.0

👌 IMPROVE:

👌 Colors ac19b49

📖 DOC:

📖 Changelog d1c172e



hr hr

RELEASE: 4.1.0

🐛 FIX:

🐛 Warning c4c7a7a

📖 DOC:

📖 Changelog 09b0fe7



hr hr

RELEASE: 4.0.0

🐛 FIX:

🐛 Symbol error b5b4ff5

📖 DOC:

📖 Changelog c164806



hr hr

RELEASE: 3.0.0

📦 NEW:

📦 Log symbols ff557b5

📖 DOC:

📖 Changelog 5108816



hr hr

RELEASE: 2.2.1

📖 DOC:

📖 Changelog 5e4c469

📖 JS docs 12dba58

📖 Changelog 0107c74



hr hr

RELEASE: 2.1.0

📖 DOC:

📖 Changelog 542d418

📖 Format c8e721e



hr hr

RELEASE: 2.0.0

🐛 FIX:

🐛 Dependencies 7eeb125

📖 DOC:

📖 Changelog update 5ed21f7



hr hr

RELEASE: 1.0.0

📦 NEW:

📦 First commit 6c6cdc2

📦 First version 8f2ca10

📖 DOC:

📖 Changelog update 1a375bd



hr hr