Retrieve the URL when errored
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 880
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 68
Description
This would solve...
When an error occured, it would be great to have requested URL which failed. It is just for logging and bugfixing purposes. Eg:
const pool = new Pool(domain);
try {
pool.request({
method: 'GET',
path: '/',
query: params,
throwOnError: true,
});
} catch (e) {
const failedUrl = magic_here;
throw new Error(`Request .... url: ${failedUrl}`);
}
Building this on my own would lead to different URL than actually was used. And it is very usefull for debbugging to know the actual URL from production environment.
The implementation should look like...
Ideally bind this property to UndiciError class.
I have also considered...
Also, export buildUrl from core/util.js. Only two properties from util.js are exported at this moment, but buildUrl is not one of them unfortunately.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting core/util.js and the exports in index.js, then trace how UndiciError is created during failed requests. Check how the request URL is assembled and carried through error handling. Done means the error exposes the actual requested URL for logging, without requiring callers to rebuild it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100