Skip to content

fetch() network failures reject with Error instead of TypeError #7195

Description

@timkelty

On workerd 1.20260828.1:

try {
  await fetch("http://127.0.0.1:1/");
} catch (error) {
  console.log(error.name, error instanceof TypeError, error.message);
  // Error false Network connection lost.
}

The Fetch standard requires network errors to reject with a TypeError.

workerd currently maps all DISCONNECTED exceptions to a plain Error here.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions