Skip to content

Wrap bare error returns in login package#6

Open
wydrox wants to merge 1 commit into
mainfrom
refactor/login-errors-audit
Open

Wrap bare error returns in login package#6
wydrox wants to merge 1 commit into
mainfrom
refactor/login-errors-audit

Conversation

@wydrox

@wydrox wydrox commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wrap bare return err in copyFile, copyBrowserProfileSnapshot, and remoteDebugGetJSON with fmt.Errorf("context: %w", err) so error traces identify the failing operation and remain compatible with errors.Is/errors.As.
  • Leave walk-callback error bubble-ups, already-wrapped error passthroughs, and chromedp ActionFunc returns unwrapped per idiomatic Go.
  • Add internal/login/errors_test.go asserting errNoRemoteDebugEndpoint stays errors.Is-compatible after wrapping.

Audit notes

  • No : %v error wrapping was found in this package; the %v -> %w conversion is a no-op here.
  • All errors.New calls in the package use static strings (no dynamic context); left untouched per spec.

Test plan

  • go vet ./...
  • go test ./... -race
  • go build -o bin/martmart ./cmd/martmart
  • GOOS=linux go build -o /tmp/martmart-linux ./cmd/martmart (cross-compile check)
  • ./bin/martmart --help and ./bin/martmart config show
  • go test ./internal/login/... -v

Add fmt.Errorf("context: %w", err) wrapping around exec/file-io/HTTP
bare `return err` paths in copyFile, copyBrowserProfileSnapshot, and
remoteDebugGetJSON so error traces identify the failing operation while
remaining compatible with errors.Is/As.

Walk-callback error bubble-ups, already-wrapped error passthroughs, and
chromedp ActionFunc returns are left unwrapped per idiomatic Go.

Audit notes:
- No %v error wrapping was found in this package (spec called for
  %v -> %w conversion; it is a no-op here).
- All errors.New calls use static strings (no dynamic context); left
  untouched per spec.
- Add errors_test.go asserting errNoRemoteDebugEndpoint remains
  errors.Is-compatible when wrapped.
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