# @sense-os/error

> Inharitable error class

Latest version **0.3.0** (published 2018-01-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install @sense-os/error
pnpm add @sense-os/error
yarn add @sense-os/error
bun add @sense-os/error
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2018-01-08 |
| First published | 2017-11-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BY Kim |
| Maintainers | sense-os |
| Keywords | error |

## Links

- npm: https://www.npmjs.com/package/@sense-os/error
- Repository: https://github.com/senseobservationsystems/sense-error
- Homepage: https://github.com/senseobservationsystems/sense-error#readme
- Issues: https://github.com/senseobservationsystems/sense-error/issues
- npm.io page: https://npm.io/package/@sense-os/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

- 0.3.0 (latest) — 2018-01-08
- 0.2.0 — 2017-11-13
- 0.1.0 — 2017-11-10

## README

# Sense Error
Inheritable error class in JS

## How to install

Run `npm install @sense-os/error --save`.

## How to use

```javascript
import SenseError from '@sense/error';

class ErrorA extends SError {};
class ErrorB extends SError {};

try {
    throw new ErrorA();
} catch (e) {
    if (e instanceOf ErrorA)
        console.log('Error type A');
    if (e instanceOf ErrorB)
        console.log('Error type B');
}

try {
    throw new ErrorB();
} catch (e) {
    const errorMap = {
        [ErrorA]: () => console.log('Error type A'),
        [ErrorB]: () => console.log('Error type B')
    };
    // Prepare the case that the `errorMap` doesn't have the key about `e`
    (errorMap[e] | () => {})();
}
```

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