Skip to content

refactor: return errors instead of logging them internally#243

Merged
alecthomas merged 1 commit intomainfrom
aat/return-errors-not-logs
Mar 31, 2026
Merged

refactor: return errors instead of logging them internally#243
alecthomas merged 1 commit intomainfrom
aat/return-errors-not-logs

Conversation

@alecthomas
Copy link
Copy Markdown
Collaborator

Functions should return errors, not log them internally, so callers
retain control over how failures are reported and handled.

  • cacheBundleSync, refreshExpiration: return error, callers log
  • handler.go: serveCached returns (bool, error), streamNonOKResponse,
    streamAndCache, fetchAndCache return error, ServeHTTP logs
  • host.go: buildTargetURL clone URL by value instead of re-parsing
  • git.go: serveReadyRepo, serveWithSpool, startClone return error
  • snapshot.go: serveSnapshotWithSpool, streamSnapshotDirect,
    writeSnapshotSpool return error
  • doFetch: remove redundant log (was logging AND returning)

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Functions should return errors, not log them internally, so callers
retain control over how failures are reported and handled.

- cacheBundleSync, refreshExpiration: return error, callers log
- handler.go: serveCached returns (bool, error), streamNonOKResponse,
  streamAndCache, fetchAndCache return error, ServeHTTP logs
- host.go: buildTargetURL clone URL by value instead of re-parsing
- git.go: serveReadyRepo, serveWithSpool, startClone return error
- snapshot.go: serveSnapshotWithSpool, streamSnapshotDirect,
  writeSnapshotSpool return error
- doFetch: remove redundant log (was logging AND returning)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alecthomas alecthomas requested a review from a team as a code owner March 31, 2026 03:42
@alecthomas alecthomas requested review from joshfriend and removed request for a team March 31, 2026 03:42
@alecthomas alecthomas enabled auto-merge (squash) March 31, 2026 03:42
@alecthomas alecthomas merged commit 88105a0 into main Mar 31, 2026
7 checks passed
@alecthomas alecthomas deleted the aat/return-errors-not-logs branch March 31, 2026 03:43
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