Skip to content

fix: Propagate download errors to callers - #270

Merged
kalbasit merged 1 commit into
mainfrom
recognize_error_early
Aug 24, 2025
Merged

kalbasit merged 1 commit into
mainfrom
recognize_error_early

Conversation

@kalbasit

@kalbasit kalbasit commented Aug 24, 2025 •

Copy link
Copy Markdown
Owner

TL;DR

Properly propagate download errors from background goroutines to callers in the cache package.

What changed?

  • Added a downloadError field to the downloadState struct to store errors that occur during downloads
  • Modified the pullNarIntoStore and pullNarInfo functions to store errors in the downloadState
  • Updated GetNar and GetNarInfo to check for and return these errors to callers
  • Fixed error handling in the server to properly handle both storage.ErrNotFound and upstream.ErrNotFound
  • Updated a test case to expect the correct error type

How to test?

  1. Test error scenarios where NAR downloads fail
  2. Verify that the correct error is propagated to the caller
  3. Confirm that the server returns appropriate HTTP status codes when errors occur

Why make this change?

Previously, errors that occurred during background NAR downloads were logged but not properly propagated to callers. This could lead to misleading error messages and incorrect behavior. This change ensures that download errors are properly captured and returned, improving error handling and making debugging easier.

@kalbasit
kalbasit marked this pull request as ready for review August 24, 2025 22:27
@kalbasit kalbasit changed the title propagate download error fix: Propagate download errors to callers Aug 24, 2025
@kalbasit
kalbasit changed the base branch from integrate_download_state to graphite-base/270 August 24, 2025 22:44
@kalbasit
kalbasit force-pushed the recognize_error_early branch from ea561ce to 21660d6 Compare August 24, 2025 22:46
@kalbasit
kalbasit changed the base branch from graphite-base/270 to integrate_download_state August 24, 2025 22:46
@kalbasit
kalbasit changed the base branch from integrate_download_state to graphite-base/270 August 24, 2025 22:53
@kalbasit
kalbasit force-pushed the recognize_error_early branch from 21660d6 to 05885c9 Compare August 24, 2025 22:53
@kalbasit
kalbasit changed the base branch from graphite-base/270 to main August 24, 2025 22:53
@kalbasit
kalbasit force-pushed the recognize_error_early branch from 05885c9 to 6f11c52 Compare August 24, 2025 22:53
@kalbasit
kalbasit force-pushed the recognize_error_early branch from 6f11c52 to 7aba5c1 Compare August 24, 2025 22:59
@kalbasit
kalbasit merged commit c51a1fb into main Aug 24, 2025

Copy link
Copy Markdown
Owner Author

Merge activity

@kalbasit
kalbasit deleted the recognize_error_early branch August 24, 2025 23:09
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.

1 participant