# iotdb-errors

> Standardized HTTP-like Errors / Exceptions

Latest version **3.1.9** (published 2019-11-24) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install iotdb-errors
pnpm add iotdb-errors
yarn add iotdb-errors
bun add iotdb-errors
```

## 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 | 3.1.9 |
| Published | 2019-11-24 |
| First published | 2016-05-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | David P. Janes |
| Maintainers | dpjanes |

## Links

- npm: https://www.npmjs.com/package/iotdb-errors
- Repository: https://github.com/dpjanes/iotdb-errors
- Homepage: https://github.com/dpjanes/node-iotdb
- Issues: https://github.com/dpjanes/iotdb-errors/issues
- npm.io page: https://npm.io/package/iotdb-errors

## Recent versions

- 3.1.9 (latest) — 2019-11-24
- 3.1.8 — 2018-08-31
- 3.1.7 — 2018-08-21
- 3.1.6 — 2018-01-22
- 3.1.5 — 2018-01-09
- 3.1.4 — 2018-01-09
- 3.1.3 — 2018-01-06
- 3.1.2 — 2017-12-30
- 3.1.1 — 2017-12-30
- 3.0.6 — 2017-09-30
- 3.0.5 — 2017-05-17
- 3.0.4 — 2017-03-24
- 3.0.3 — 2017-01-23
- 3.0.2 — 2016-08-18
- 3.0.1 — 2016-08-18
- … 3 more at https://npm.io/package/iotdb-errors/versions

## README

# iotdb-errors
IOTDB Module that defines all sorts of useful Error exceptions, 
with HTTP status codes built in.

<img src="https://raw.githubusercontent.com/dpjanes/iotdb-homestar/master/docs/HomeStar.png" align="right" />

# Installation

If you installed [Home☆Star](https://github.com/dpjanes/iotdb-homestar) you've
already got it.

If you want to use this stand-alone:

    $ npm install iotdb-errors

# Exceptions defined

* Internal (500)
* Invalid (403) - something is improperly formatted
* MethodNotAllowed (405) - e.g. doing a PUT where only GET is allowed
* NeverImplemented (501)
* NotAppropriate (403) - expecting a thing and got a recipe
* NotAuthorized (401)
* NotFound (404)
* NotImplemented (501)
* ShouldBeImplementedInSubclass (501)
* ServiceNotAvailable (503) - e.g. we're connecting to Redis and it doesn't work
* SetupRequired (500)
* Timestamp (409) - the timestamp is out of date

# Use

Just do the usual

    const errors = requre("iotdb-errors");

    throw new errors.NotImplemented()

If you want to get the error code

    error = errors.NotImplemented()
    error.code

If you've got [iotdb](https://iotdb.org) installed, there's a
few helper functions for working with exceptions which may or 
may not be from this module, may not exist at all, etc..

    const iotdb = require("iotdb")
    const _ = iotdb._;

    _.error.code(error)             // will return code, 500 if no code defined
    _.error.code(error, 404)        // will return code, 404 if no code defined
    _.error.message(error)          // will return the message, or null
    _.error.message(error, "woah")  // will return the message, or "woah"

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