# ts-err

> TypeScript Exceptions

Latest version **1.0.0** (published 2022-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-err
pnpm add ts-err
yarn add ts-err
bun add ts-err
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-05-20 |
| First published | 2022-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | stateless-studio |
| Maintainers | stateless-studio |

## Links

- npm: https://www.npmjs.com/package/ts-err
- Repository: https://github.com/StatelessStudio/ts-err
- Homepage: https://github.com/StatelessStudio/ts-err#readme
- Issues: https://github.com/StatelessStudio/ts-err/issues
- npm.io page: https://npm.io/package/ts-err

## Recent versions

- 1.0.0 (latest) — 2022-05-20

## README

# ts-err

## Installation

`npm i ts-err`

## Basic Errors

ApplicationError(*message: string*, *context: any*, *previous: Error*)

```typescript
import { ApplicationError } from 'ts-error';

const a = 5;

throw new ApplicationError('Something happened!', {
	value: a
});
```

## Error chains

```typescript
import { ApplicationError } from 'ts-error';

try {
	throw new Error('Hello!');
}
catch(e) {
	throw new ApplicationError('Greeting failed', null, e);
}
```

## Http Errors (with Axios)

HttpError(*message: string*, *error: any*)

```typescript
import { default as axios } from 'axios';
import { HttpError } from 'ts-err';

axios.get('https://google.com/teapot').catch(err => {
	throw new HttpError('Could not fetch teapot', err);
})
```

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