@chubbyts/chubbyts-throwable-to-error
Version:
It converts any throwable into an Error.
53 lines (37 loc) • 3.69 kB
Markdown
# chubbyts-throwable-to-error
[](https://github.com/chubbyts/chubbyts-throwable-to-error/actions?query=workflow%3ACI)
[](https://coveralls.io/github/chubbyts/chubbyts-throwable-to-error?branch=master)
[](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-throwable-to-error/master)
[](https://www.npmjs.com/package/@chubbyts/chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
[](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-throwable-to-error)
## Description
It converts any throwable into an Error.
## Requirements
* node: 18
## Installation
Through [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-throwable-to-error][1].
```ts
npm i @chubbyts/chubbyts-throwable-to-error@^2.0.2
```
## Usage
```ts
import { throwableToError } from '@chubbyts/chubbyts-throwable-to-error/dist/throwable-to-error';
try {
throw {key: 'value'};
} catch (e) {
const error = throwableToError(e);
}
```
## Copyright
2025 Dominik Zogg
[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-throwable-to-error