# flux-standard-error

> flux standard action for representing errors

Latest version **1.0.0** (published 2017-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install flux-standard-error
pnpm add flux-standard-error
yarn add flux-standard-error
bun add flux-standard-error
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-09-02 |
| First published | 2017-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Steven Silvestri |
| Maintainers | ssilve1989 |
| Keywords | flux, redux, fsa, flux standard action, error, flux error |

## Links

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

## 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

- 1.0.0 (latest) — 2017-09-02
- 0.1.0 — 2017-09-02

## README

# flux-standard-error

A simple function to consistently generate standard Flux Action Errors. It follows these simple rules:

- An `error` property must exist, and will be set to true
- The payload must be the Error.

## Usage

Sample Action

```javascript
import createError from 'flux-standard-error';

const myFancyAction = () => (dispatch) => {
   try { 
       // some error happens
   } catch(e) {
       dispatch(createError(e, MY_UNEXPECTED_ERROR, MY_FANCY_ACTION))
   }
}

```

It takes the following arguments, taken from the jsdoc

```javascript
/*
 * @param {Error} error - The actual Error object
 * @param {string} type - The type to dispatch
 * @param {string} cause - The cause of the error
 * @param {object} [meta] - Additional information to be inserted into the meta property
 * @returns {{type: string, payload: Error, error: boolean, meta: {cause: string}}}
 */
```
The meta object is useful to stuffing in any additional data that might be needed to handle the error.

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