Chore: log failed URL
Some checks are pending
Build / Build (push) Waiting to run
Build / Diff output (push) Blocked by required conditions
Build / Deploy to Cloudflare Pages (push) Blocked by required conditions
Build / Deploy to GitHub and GitLab (push) Blocked by required conditions

This commit is contained in:
SukkaW
2025-02-08 22:26:06 +08:00
parent 339eecb39b
commit 9354cf1d28

View File

@@ -42,6 +42,10 @@ setGlobalDispatcher(agent.compose(
retry(err, { state, opts }, cb) {
const errorCode = 'code' in err ? (err as NodeJS.ErrnoException).code : undefined;
Object.defineProperty(err, '_url', {
value: opts.method + ' ' + opts.origin?.toString() + opts.path
});
// Any code that is not a Undici's originated and allowed to retry
if (
errorCode === 'ERR_UNESCAPED_CHARACTERS'
@@ -151,7 +155,7 @@ export const defaultRequestInit = {
}
};
export async function $$fetch(url: string, init?: RequestInit) {
export async function $$fetch(url: string, init: RequestInit = defaultRequestInit) {
try {
const res = await undici.fetch(url, init);
if (res.status >= 400) {