{"repo":"ehmicky/handle-cli-error","free":true,"listed":false,"github":"https://github.com/ehmicky/handle-cli-error","clone":"git clone https://github.com/ehmicky/handle-cli-error.git","description":"💣 Error handler for CLI applications 💥","language":"JavaScript","stars":28,"topics":["bash","cli","console","error","error-handling","error-monitoring","errors","exit","exitcode","handler"],"license":"MIT","category":"cli-tools","readme_excerpt":"Error handler for CLI applications. Features - 🖍️ Pretty colors, icons and header - 💣 Error class-specific and custom handling - 🚒 Graceful exit - ⛑️ Normalize invalid errors - 🔕 Log verbosity: message, stack, nested errors, properties - 🚨 Custom exit code and log function - 💥 Exception-safe Screenshot Example General Error class-specific Install This package works in Node.js =18.18.0. This is an ES module. It must be loaded using an import or import() statement, not require() . If TypeScript is used, it must be configured to output ES modules, not CommonJS. API handleCliError(error, options?) error any \\ options Options? \\ Return value : undefined Logs error on the console ( stderr ) then exits the process. This never throws. Invalid errors are silently normalized. Options 🚨 exitCode Type : integer \\ Default : 1 Process exit code. We recommend values between 1 and 124 because the following exit codes have some special meaning: - 0: success - 125: invalid options - 126 to 255: used by shells like Bash 📕 stack Type : boolean \\ Default : true Whether to log the error's stack trace. 🪏 cause Type : boolean \\ Default : true Whether to show nested errors, i.e. error.cause and error.errors . 📢 props Type : boolean \\ Default : true Whether to log the error's additional properties. 🔕 silent Type : boolean \\ Default : false Exits the process without logging anything on the console. 🖍️ colors Type : boolean \\ Default : true in terminals, false otherwise Whether to colorize t","default_branch":null,"files":null,"tree":[],"storefront":"/r/ehmicky","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ehmicky/handle-cli-error/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}