# ts-http-errors

> http errors boilerplates

Latest version **1.0.0** (published 2019-02-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install ts-http-errors
pnpm add ts-http-errors
yarn add ts-http-errors
bun add ts-http-errors
```

Provides the command `generate`.

## 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 | 2019-02-28 |
| First published | 2019-02-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 27.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | pavel.ivanov |
| Maintainers | pawskal |
| Keywords | nodejs, node-js, express, typescript, type-script, http, http-errors, ts-http-errors, ts-errors, typescript-errors, http-error, ts-http-error, ts-error |

## Links

- npm: https://www.npmjs.com/package/ts-http-errors
- Repository: https://github.com/pawskal/ts-http-errors.git#v1.0.0
- Homepage: https://github.com/pawskal/ts-http-errors#readme
- Issues: https://github.com/pawskal/ts-http-errors.git/issues
- npm.io page: https://npm.io/package/ts-http-errors

## Dependencies (1)

- [typescript](https://npm.io/package/typescript.md) ^3.3.3333

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-02-28

## README

### Http Error Set

### Usage
```
npm install ts-http-errors --save
```

### Usage
import error from lib with postfix Error
```typescript
import { NotFoundError } from 'ts-http-errors';

throw new NotFoundError("Not Found Message");
```

expexted object
```json
{
  "status": 404,
  "message": "Not Found Message",
  "name": "NotFoundError"
}
```

Every objects inherited from `Error`
Inside code status becomes to statusCode for backward capabilities with `express`

#### Available errors 
```json
[
  { "400": "BadRequest" },
  { "401": "Unauthorized" },
  { "402": "PaymentRequired" },
  { "403": "Forbidden" },
  { "404": "NotFound" },
  { "405": "MethodNotAllowed" },
  { "406": "NotAcceptable" },
  { "407": "ProxyAuthenticationRequired" },
  { "408": "RequestTimeout" },
  { "409": "Conflict" },
  { "410": "Gone" },
  { "411": "LengthRequired" },
  { "412": "PreconditionFailed" },
  { "413": "PayloadTooLarge" },
  { "414": "URITooLong" },
  { "415": "UnsupportedMediaType" },
  { "416": "RangeNotSatisfiable" },
  { "417": "ExpectationFailed" },
  { "418": "IAmATeapot" },
  { "419": "AuthenticationTimeout" },
  { "421": "MisdirectedRequest" },
  { "422": "UnprocessableEntity" },
  { "423": "Locked" }, 
  { "424": "FailedDependency" },
  { "426": "UpgradeRequired" },
  { "428": "PreconditionRequired" },
  { "429": "TooManyRequests" },
  { "431": "RequestHeaderFieldsTooLarge" },
  { "449": "RetryWith" },
  { "451": "UnavailableForLegalReasons" },
  { "499": "ClientClosedRequest" },
  { "500": "InternalServer" },
  { "501": "NotImplemented" },
  { "502": "BadGateway" },
  { "503": "ServiceUnavailable" },
  { "504": "GatewayTimeout" },
  { "505": "HTTPVersionNotSupported" },
  { "506": "VariantAlsoNegotiates" },
  { "507": "InsufficientStorage" },
  { "508": "LoopDetected" },
  { "509": "BandwidthLimitExceeded" },
  { "510": "NotExtended" },
  { "511": "NetworkAuthenticationRequired" },
  { "520": "Unknown" },
  { "521": "WebServerIsDown" },
  { "522": "ConnectionTimedOut" },
  { "523": "OriginIsUnreachable" },
  { "524": "ATimeoutOccurred" },
  { "525": "SSLHandshakeFailed" },
  { "526": "InvalidSSLCertificate" }
]
```

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