Skip to content

Fix error comparison and reflection robustness in share-link commands#299

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
fix/share-link-error-handling
Jun 28, 2026
Merged

Fix error comparison and reflection robustness in share-link commands#299
AndreyVMarkelov merged 1 commit into
masterfrom
fix/share-link-error-handling

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace fragile interface pointer comparisons (parsed == &appErr) with reflection-based samePointer helper that correctly compares underlying pointer addresses regardless of interface wrapper type
  • Migrate all err != wantErr test assertions to errors.Is(err, wantErr) for correct wrapped-error handling
  • Extract ErrorSummary via direct field reflection instead of CanInterface() + type assertion to avoid pitfalls with unexported fields

Test plan

  • go test ./cmd/... passes
  • golangci-lint run clean
  • Share-link error paths (create existing link, revoke non-existent, download API error) return correct errors

Replace fragile interface pointer comparisons with reflection-based
samePointer helper, migrate error assertions to errors.Is for correct
wrapped-error handling, and extract ErrorSummary via direct field
reflection to avoid CanInterface pitfalls.
@AndreyVMarkelov AndreyVMarkelov merged commit 9cca8f5 into master Jun 28, 2026
8 checks passed
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