Update gitignore (sorry)
This commit is contained in:
parent
a8f8c4d7ad
commit
cca8b02fea
6604 changed files with 1219661 additions and 4 deletions
55
electron/node_modules/ensure-error/readme.md
generated
vendored
Normal file
55
electron/node_modules/ensure-error/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# ensure-error [](https://travis-ci.org/sindresorhus/ensure-error)
|
||||
|
||||
> Ensures a value is a valid error by making it one if not
|
||||
|
||||
Pass it any value and you're are guaranteed to get back an `Error` with `name`, `message`, and `stack` properties.
|
||||
|
||||
Can be useful when you don't control all the places an error can be thrown or rejected. A user could for example throw a string or an error without a `stack` property.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ensure-error
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ensureError = require('ensure-error');
|
||||
|
||||
const error = new TypeError('🦄');
|
||||
error.name = '';
|
||||
|
||||
console.log(error.name);
|
||||
//=> ''
|
||||
|
||||
console.log(ensureError(error).name);
|
||||
//=> 'TypeError'
|
||||
```
|
||||
|
||||
```js
|
||||
const ensureError = require('ensure-error');
|
||||
|
||||
console.log(ensureError(10));
|
||||
//=> [NonError: 10]
|
||||
```
|
||||
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### ensureError(input)
|
||||
|
||||
If `input` is an `Error`, any missing `Error` properties will be added.<br>
|
||||
If it's not an `Error`, `input` is converted to an `Error`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `unknown`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Loading…
Add table
Add a link
Reference in a new issue