Join errors so they are detectable by errors.Is#4934
Conversation
|
A concern is that the error |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f7771e8. Configure here.
| if err := chunkResult.Error(); err != nil { | ||
| h.metrics.incErrors() | ||
| dataOrErr.Err = fmt.Errorf("%w: error reading chunk: %v", ErrProcessingWarning, err) | ||
| dataOrErr.Err = fmt.Errorf("error reading chunk: %w", errors.Join(ErrProcessingWarning, err)) |
There was a problem hiding this comment.
Joined warning errors may be misclassified as fatal
Medium Severity
Using errors.Join(ErrProcessingWarning, err) preserves the full error chain of the inner err. If that error wraps context.Canceled or context.DeadlineExceeded (possible when the underlying reader is a network stream or pipe), isFatal will match the first switch case (fatal) before reaching the ErrProcessingWarning case (non-fatal). This causes a supposedly recoverable warning to terminate file processing, contradicting the explicit continue on the next line. The old %v formatting intentionally broke the inner error chain to prevent this.
Reviewed by Cursor Bugbot for commit f7771e8. Configure here.


Description:
The purpose of this PR is to have both of the errors emitted by their log lines be joined so that they are detectable by
isFatalin `handlers.go.Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Small change limited to error composition in non-archive chunk processing; main risk is altered error strings/unwrap structure affecting tests or log expectations.
Overview
Updates
defaultHandler.handleNonArchiveContenterror wrapping to useerrors.Joinso emitted chunk read/write errors retainErrProcessingWarning/ErrProcessingFatalin the error chain and can be detected viaerrors.Is(e.g., byisFatal).This changes the formatting of the propagated errors to wrap the joined sentinel+underlying error as the
%wcause while keeping the log message text stable ("error reading chunk" / "error writing to data channel").Reviewed by Cursor Bugbot for commit f7771e8. Bugbot is set up for automated code reviews on this repo. Configure here.