# abort-error

> An error to be used by AbortSignal handlers

Latest version **1.0.2** (published 2026-04-10) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install abort-error
pnpm add abort-error
yarn add abort-error
bun add abort-error
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2026-04-10 |
| First published | 2024-10-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Author | Alex Potsides |
| Maintainers | achingbrain |

## Links

- npm: https://www.npmjs.com/package/abort-error
- Repository: https://github.com/achingbrain/abort-error
- Homepage: https://github.com/achingbrain/abort-error#readme
- Issues: https://github.com/achingbrain/abort-error/issues
- npm.io page: https://npm.io/package/abort-error

## Recent versions

- 1.0.2 (latest) — 2026-04-10
- 1.0.1 — 2025-03-19
- 1.0.0 — 2024-10-24
- 0.0.0 — 2024-10-24

## README

# abort-error

[![codecov](https://img.shields.io/codecov/c/github/achingbrain/abort-error.svg?style=flat-square)](https://codecov.io/gh/achingbrain/abort-error)
[![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/abort-error/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/achingbrain/abort-error/actions/workflows/js-test-and-release.yml?query=branch%3Amain)

> An error to be used by AbortSignal handlers

# About

<!--

!IMPORTANT!

Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.

To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts

To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.

-->

A simple error class and options interface that seems to get copied from
project to project.

## Example - Using AbortError

```JavaScript
import { AbortError } from 'abort-error'

// a promise that will be settled later
const deferred = Promise.withResolvers()

const signal = AbortSignal.timeout(1000)
signal.addEventListener('abort', () => {
  deferred.reject(new AbortError())
})
```

## Example - Using AbortOptions

```TypeScript
import type { AbortOptions } from 'abort-error'

async function myFunction (options?: AbortOptions) {
  return fetch('https://example.com', {
    signal: options?.signal
  })
}
```

# Install

```console
$ npm i abort-error
```

## Browser `<script>` tag

Loading this module through a script tag will make its exports available as `AbortError` in the global namespace.

```html
<script src="https://unpkg.com/abort-error/dist/index.min.js"></script>
```

# API Docs

- <https://achingbrain.github.io/abort-error>

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](https://github.com/achingbrain/abort-error/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/achingbrain/abort-error/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

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