nodejs / nodejs/undici

Provide a more descriptive error on fetching "file" scheme

Open
#3,741 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
7.7k
Forks
880
Avg merge
2d 16h
Merged PRs (30d)
68

Description

This would solve...

The current error is cryptic, to say the least:

https://github.com/nodejs/undici/blob/68107da3fdd6cd0397f4800a2bc9630c802eda58/lib/web/fetch/index.js#L945

The implementation should look like...

makeNetworkError('Failed to fetch the "file" URL scheme: not implemented')

Additional context

There's an existing better error for an unsupported URL schemes, like about:

https://github.com/nodejs/undici/blob/68107da3fdd6cd0397f4800a2bc9630c802eda58/lib/web/fetch/index.js#L786

I'd still like to have it mention "fetch" at least somewhere so it's clear where the issue originates from.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect lib/web/fetch/index.js at the referenced file-scheme error and compare it with the existing unsupported-scheme error around the other referenced location. Update the file-scheme message to identify fetch and state that the scheme is not implemented, then verify the resulting error wording.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.