Socket
Socket
Sign inDemoInstall

@c8/errors

Package Overview
Dependencies
3
Maintainers
6
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"name": "@c8/errors",
"version": "0.0.4",
"version": "0.0.5",
"description": "Common errors and their utils used by C8 management",

@@ -5,0 +5,0 @@ "main": "index.js",

# @c8/errors
Common error type in our components
Common error types and utils for use in our components
## Usage
- `npm i --save @c8/errors`
```javascript
'use strict'
- ```javascript
const Errors = require('@c8/errors')
```
// You will typically be fine just keeping the default mapping
### Throw a custom Error with parameters
```javascript
throw new Errors.TypeError('Error message', {
myParam1: 'Foo',
myParam2: 'Bar'
})
```
### Translate your error to Boom error
#### With defaut mapping
```javascript
let boomErr = Errors.utils.toBoom(err)
```
// But you can also specify the second parameter of toBoom() if I don't like the default mapping
#### With custom mapping
```javascript
let boomErr = Errors.utils.toBoom(err, {

@@ -15,0 +29,0 @@ entityTooLarge: ['FileTooLargeError'],

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc