Skip to content

bug: network fetch errors bubble up with no context #3

@satoshai-dev

Description

@satoshai-dev

Description

fetch(url) can reject with a TypeError for network-level failures (no internet, DNS failure, ECONNREFUSED to devnet). The current code only handles HTTP status codes — network rejections propagate as raw TypeError: fetch failed with no context about which contract or network was being fetched.

Location

src/fetcher.ts:34const response = await fetch(url);

Suggested fix

let response: Response;
try {
  response = await fetch(url);
} catch (cause) {
  throw new Error(
    `Network error fetching ABI for ${address}.${name} on ${network}`,
    { cause },
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions