Skip to content

Wrap fetch() in try/catch to handle network failures gracefully#8

Merged
Mayank-glitch-cpu merged 2 commits intocodex/integrate-ashby-job-ingestion-strategyfrom
copilot/sub-pr-2-please-work
Feb 11, 2026
Merged

Wrap fetch() in try/catch to handle network failures gracefully#8
Mayank-glitch-cpu merged 2 commits intocodex/integrate-ashby-job-ingestion-strategyfrom
copilot/sub-pr-2-please-work

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 11, 2026

The fetchCompanyJobs function lacked error handling around the fetch() call. With the expanded slug pool, a single DNS timeout, connection reset, or network error would abort the entire Step 1 run instead of continuing to the next company.

Changes:

  • Wrapped fetch() and response.json() in try/catch block
  • Network failures now log error and return [], allowing iteration to continue
  • Error message includes slug and exception details for debugging
try {
  const response = await fetch(url.toString(), { ... });
  if (!response.ok) {
    log('fetch', 'warn', `  Ashby API returned ${response.status} for ${slug}`);
    return [];
  }
  const result: AshbyPublicResponse = await response.json();
  return result.jobs?.map(...) ?? [];
} catch (error) {
  log('fetch', 'error', `  Network error fetching ${slug}: ${error instanceof Error ? error.message : String(error)}`);
  return [];
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ilures

Co-authored-by: Mayank-glitch-cpu <85422185+Mayank-glitch-cpu@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Ashby slug pool expansion and API updates Wrap fetch() in try/catch to handle network failures gracefully Feb 11, 2026
@Mayank-glitch-cpu Mayank-glitch-cpu marked this pull request as ready for review February 11, 2026 18:53
@Mayank-glitch-cpu Mayank-glitch-cpu merged commit b91c391 into codex/integrate-ashby-job-ingestion-strategy Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants