fix: selectively downgrade expected errors from Error to Warn#568
Merged
wizzomafizzo merged 3 commits intomainfrom Mar 19, 2026
Merged
fix: selectively downgrade expected errors from Error to Warn#568wizzomafizzo merged 3 commits intomainfrom
wizzomafizzo merged 3 commits intomainfrom
Conversation
Sentry noise reduction: 8 of 10 reported error groups are expected operational conditions (hardware disconnects, client disconnects, title-not-found, unsupported control commands) logged at Error level. Selective downgrades using sentinel errors and errors.Is(): - PN532: fatal hardware errors (device gone) via pn532.IsFatal() - WebSocket: session closed via melody.ErrSessionClosed - API client: closed connection via net.ErrClosed - TUI: notification handler GetReaders timeout (startup call stays Error) - ZapScript: title not found (titles.ErrNoMatch) and no control capabilities (new ErrNoControlCapabilities sentinel) Unexpected/unknown errors remain at Error level in all paths.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add TestLogWSWriteError (server_logging_test.go): - Verifies melody.ErrSessionClosed logs at warn level - Verifies wrapped session closed errors log at warn level - Verifies other errors log at error level Add TestLogTraceableError (pn532_test.go): - Verifies context.Canceled logs at debug level - Verifies fatal hardware errors (ErrDeviceNotFound, ErrTransportClosed) log at warn level - Verifies other errors log at error level
Add TestHandlePostRequest_ExpectedError (server_post_test.go): - Covers the ErrNoControlCapabilities warn-level branch in handleRequest Expand TestLogTraceableError (pn532_test.go): - Add wire trace case verifying transport/port/trace data is logged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
errors.Is(), keeping Error level for unexpected/unknown errors in all pathsErrNoControlCapabilitiessentinel error for launchers without control supportlogWSWriteErrorhelper for consistent WebSocket write error handling across all write sites (response, broadcast, pong, panic recovery)Errors addressed:
pn532.IsFatal()→ Warnmelody.ErrSessionClosed→ Warnnet.ErrClosed→ Warntitles.ErrNoMatch→ WarnErrNoControlCapabilities→ WarnNot changed: #5 (TTY stuck — deferred, monitoring), #7 (log upload 403 — keep Error for visibility)