abort-error
    Preparing search index...

    abort-error

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

    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())
    })
    import type { AbortOptions } from 'abort-error'

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

    Classes

    AbortError

    Interfaces

    AbortOptions