@chubbyts/chubbyts-http-error
Version:
Creates http error which can be catched and converted to error responses.
58 lines (42 loc) • 3.79 kB
Markdown
# chubbyts-http-error
[](https://github.com/chubbyts/chubbyts-http-error/actions?query=workflow%3ACI)
[](https://coveralls.io/github/chubbyts/chubbyts-http-error?branch=master)
[](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-http-error/master)
[](https://www.npmjs.com/package/@chubbyts/chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-error)
## Description
Creates http error which can be catched and converted to error responses.
## Requirements
* node: 18
## Installation
Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-http-error][1].
```ts
npm i @chubbyts/chubbyts-http-error@^2.4.2
```
## Usage
```ts
import { createNotFound } from '@chubbyts/chubbyts-http-error/dist/http-error';
try {
throw createNotFound({ detail: 'Something went wrong', instance: 'server-1', otherKey: 'otherValue' });
} catch (e) {
console.log(e);
}
```
## Copyright
2025 Dominik Zogg
[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-error
[2]: https://web-frameworks-benchmark.netlify.app/result
[3]: https://www.php-fig.org/psr/psr-15
[4]: https://www.npmjs.com/package/@chubbyts/chubbyts-dic-types
[5]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-types
[6]: https://www.npmjs.com/package/@chubbyts/chubbyts-log-types