Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a more descriptive error on fetching "file" scheme #3741

Open
kettanaito opened this issue Oct 16, 2024 · 3 comments
Open

Provide a more descriptive error on fetching "file" scheme #3741

kettanaito opened this issue Oct 16, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@kettanaito
Copy link
Contributor

kettanaito commented Oct 16, 2024

This would solve...

The current error is cryptic, to say the least:

return Promise.resolve(makeNetworkError('not implemented... yet...'))

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:

return Promise.resolve(makeNetworkError('about scheme is not supported'))

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

@kettanaito kettanaito added the enhancement New feature or request label Oct 16, 2024
@kettanaito
Copy link
Contributor Author

The comment above the network error also mentions that file fetching is left as an exercise for the reader. Is there a workaround for this, somehow?

I'm stumbling upon this through another library so I have no control over that fetch request. Can I "teach" Undici to fetch files? Can I override this behavior in any way, not being in charge of that request-issuing library? (it loads a WASM)

@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@KhafraDev
Copy link
Member

Can I "teach" Undici to fetch files? Can I override this behavior in any way, not being in charge of that request-issuing library?

We've decided in previous discussions not to support fetching file urls, it cannot be changed. Realistically, there isn't a good way for us to satisfy security requirements and user requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants