# plugin-error

> Error handling for Vinyl plugins.

Latest version **2.0.1** (published 2022-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install plugin-error
pnpm add plugin-error
yarn add plugin-error
bun add plugin-error
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-12-06 |
| First published | 2015-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 1 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Gulp Team |
| Maintainers | yocontra, phated |
| Keywords | error, plugin, gulp-util |

## Links

- npm: https://www.npmjs.com/package/plugin-error
- Repository: https://github.com/gulpjs/plugin-error
- Homepage: https://github.com/gulpjs/plugin-error#readme
- Issues: https://github.com/gulpjs/plugin-error/issues
- npm.io page: https://npm.io/package/plugin-error

## Dependencies (1)

- [ansi-colors](https://npm.io/package/ansi-colors.md) ^1.0.1

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2022-12-06
- 2.0.0 — 2022-07-01
- 1.0.1 — 2018-01-23
- 1.0.0 — 2018-01-14
- 0.1.2 — 2015-06-01
- 0.1.1 — 2015-05-01
- 0.1.0 — 2015-04-26

## README

<p align="center">
  <a href="http://gulpjs.com">
    <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  </a>
</p>

# plugin-error

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Error handling for Vinyl plugins.

## Usage

```js
var PluginError = require('plugin-error');

var err = new PluginError('test', {
  message: 'something broke',
});

var err = new PluginError({
  plugin: 'test',
  message: 'something broke',
});

var err = new PluginError('test', 'something broke');

var err = new PluginError('test', 'something broke', { showStack: true });

var existingError = new Error('OMG');
var err = new PluginError('test', existingError, { showStack: true });
```

## API

### `new PluginError(pluginName, message[, options])`

Error constructor that takes:

- `pluginName` - a `String` that should be the module name of your plugin
- `message` - a `String` message or an existing `Error` object
- `options` - an `Object` of your options

**Behavior:**

- By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error.
- If you pass an error object as the message the stack will be pulled from that, otherwise one will be created.
- If you pass in a custom stack string you need to include the message along with that.
- Error properties will be included in `err.toString()`, but may be omitted by including `{ showProperties: false }` in the options.

## License

MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/plugin-error.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/plugin-error
[npm-image]: https://img.shields.io/npm/v/plugin-error.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/plugin-error/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/plugin-error/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/plugin-error
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/plugin-error/master.svg?style=flat-square
<!-- prettier-ignore-end -->

---
_Source: https://npm.io/package/plugin-error · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
