Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handle-cli-error

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handle-cli-error - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

build/src/options/classes.js

6

build/src/main.d.ts

@@ -47,3 +47,3 @@ /**

/**
* Specify different options per error type. The object:
* Specify different options per error class. The object:
* - Keys are either the

@@ -65,4 +65,4 @@ * [`error.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name),

*/
readonly types?: {
readonly [errorName: string]: Omit<Options, 'types'>
readonly classes?: {
readonly [errorName: string]: Omit<Options, 'classes'>
}

@@ -69,0 +69,0 @@ }

@@ -7,4 +7,4 @@ import isPlainObj from"is-plain-obj";

import{applyClassesOpts}from"./classes.js";
import{applyDefaultOpts}from"./default.js";
import{applyTypesOpts}from"./types.js";
import{handleInvalidOpts,validateOpts}from"./validate.js";

@@ -27,3 +27,3 @@

const optsA=applyTypesOpts(opts,error);
const optsA=applyClassesOpts(opts,error);
const optsB=applyDefaultOpts(optsA);

@@ -30,0 +30,0 @@ validateOpts(optsB);

{
"name": "handle-cli-error",
"version": "1.1.1",
"version": "2.0.0",
"type": "module",

@@ -49,6 +49,6 @@ "exports": "./build/src/main.js",

"devDependencies": {
"@ehmicky/dev-tasks": "^1.0.84",
"@ehmicky/dev-tasks": "^1.0.85",
"@sinonjs/fake-timers": "^9.1.2",
"execa": "^6.1.0",
"test-each": "^5.2.1"
"test-each": "^5.3.0"
},

@@ -61,4 +61,4 @@ "engines": {

"is-plain-obj": "^4.1.0",
"normalize-exception": "^2.1.0"
"normalize-exception": "^2.2.0"
}
}

@@ -16,3 +16,3 @@ <picture>

- 💣 [Error type-specific](#-types) handling
- 💣 [Error class-specific](#-classes) handling
- 🚒 [Graceful exit](#-timeout)

@@ -43,7 +43,7 @@ - ⛑️ [Normalize](https://github.com/ehmicky/normalize-exception) invalid errors

## Error type-specific
## Error class-specific
```js
handleCliError(error, {
types: {
classes: {
InputError: { exitCode: 1, short: true },

@@ -122,3 +122,3 @@ DatabaseError: { exitCode: 2, short: true },

#### 💣 types
#### 💣 classes

@@ -128,3 +128,3 @@ _Type_: `object`\

Specify [different options per error type](#error-type-specific). The object:
Specify [different options per error class](#error-class-specific). The object:

@@ -141,4 +141,4 @@ - Keys are either the

- [`create-error-types`](https://github.com/ehmicky/create-error-types): Create
multiple error types
- [`error-type`](https://github.com/ehmicky/error-type): Create one error type
multiple error classes
- [`error-type`](https://github.com/ehmicky/error-type): Create one error class
- [`error-serializer`](https://github.com/ehmicky/error-serializer): Convert

@@ -145,0 +145,0 @@ errors to/from plain objects

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc