Skip to content

cryptic error message for already aborted signals #2242

@jimmywarting

Description

@jimmywarting

Undici have the most crypting error message when sending in an already aborted signal.

example:

fetch('http://localhost', { signal: AbortSignal.abort('Already aborted') })
  .catch(e => console.log({ctor: e.constructor.name, code: e.code, message: e.message}))

undici:

{ ctor: 'TypeError', code: undefined, message: 'invalid_argument' }

Chrome:

{ ctor: 'DOMException', code: 20, message: "Failed to execute 'fetch' on 'Window': The user aborted a request."}

Safari:

{ ctor: "DOMException", code: 20, message: "Request signal is aborted"}

Firefox & Deno:

{ ctor: "String", code: undefined, message: undefined }
// returns the abort reason, so the result is "Already aborted"

// With an undefined reason it throw
{ ctor: "DOMException", code: 20, message: "The operation was aborted. " }

i tough i sent in something really wrong type when i was calling fetch when i received a TypeError.
but it's of a correct "type".

{ signal: "foo" } is an TypeError and a invalid argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions