fix(api): log test-connection failures with provider context#432
Open
funkypenguin wants to merge 1 commit into
Open
fix(api): log test-connection failures with provider context#432funkypenguin wants to merge 1 commit into
funkypenguin wants to merge 1 commit into
Conversation
The /api/test-usenet-connection endpoint silently caught both
CouldNotConnectToUsenetException and CouldNotLoginToUsenetException
and returned `connected: false` with no logging. Users seeing
"Connection test failed" in the UI had no way to diagnose the
underlying cause (bad credentials, DNS failure, TLS handshake
failure, server-side rejection, unreachable host, etc.).
Add Serilog warnings to each catch block, including host, port,
SSL flag, user, and the inner exception message. The connect and
login paths log distinct prefixes ("connect error" / "login error")
so operators can quickly tell which step failed.
Also catch unexpected non-cancellation exceptions, log with stack
trace, then rethrow so BaseApiController's existing 500 handler
still runs and the frontend continues to receive its current error
shape for non-NNTP failures.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
The
/api/test-usenet-connectionendpoint silently swallowsCouldNotConnectToUsenetExceptionandCouldNotLoginToUsenetExceptionand returnsconnected: falsewith no log line. Users hitting "Connection test failed" in the UI have no way to diagnose the actual cause — bad credentials, DNS failure, TLS handshake failure, server-side rejection, unreachable host, etc. — without attaching a debugger or packet-sniffing.I hit this debugging a real provider misconfiguration this week: the UI showed the generic red banner and the pod logs were silent. The fix took five minutes once I knew the error message; finding the message took much longer.
Changes
backend/Api/Controllers/TestUsenetConnection/TestUsenetConnectionController.cs:Log.Warningto theCouldNotConnectToUsenetExceptioncatch — prefixedconnect error.Log.Warningto theCouldNotLoginToUsenetExceptioncatch — prefixedlogin error.BaseApiController's existing 500 handler still runs (preserves the frontend's"Failed to test connection"branch for non-NNTP failures).Each log line includes host, port, SSL flag, user, and the inner exception message:
The wire-format response is unchanged —
connected: falsestill goes back on the typed exceptions. This is purely additive observability.Test plan
dotnet buildclean (0 errors, 77 pre-existing warnings)login error: 481 ...connect error: ...connected: truereturned🤖 Generated with Claude Code