Skip to content

Improve error handling: log instead of silently swallowing exceptions - #1

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782311863-improve-error-handling
Open

Improve error handling: log instead of silently swallowing exceptions#1
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782311863-improve-error-handling

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Multiple catch blocks across the WebSocket proxy layer were empty or used ignored — failures in forwarding messages, closing connections, and handling upstream errors were completely invisible. This makes debugging production issues nearly impossible.

Changes:

  • NewBingGoGoClientWebSocket: All three empty/silent catch blocks now log with appropriate severity:

    // Before (onClose, onError): catch (IOException e) {}
    // After:
    catch (IOException e) {
        LOG.warn("Failed to close server WebSocket (code={}, reason={})", code, reason, e);
    }
  • NewBingGoGoServerWebSocket: onException was closing the client silently; ping failures cancelled the task without any trace. Both now log WARN/ERROR.

  • NewBingGoGoServer:

    • getReturnErrorWebSocket.onOpen(): catch (IOException ignored) → logs the failure
    • getReturnErrorWebSocket.onException(): was a no-op → now logs the error
    • goUrl() header copy: guards against null values (previously passed null to addRequestProperty)
    • goUrl() stream reading: handles missing Content-Length (-1) and premature EOF instead of looping on a negative length or writing -1 bytes
  • Added private static final Logger LOG (SLF4J) to all three application classes for consistent structured logging.

All logging uses SLF4J (already a project dependency via slf4j-log4j12). No behavioral changes — just visibility into previously-silent failures."

Link to Devin session: https://app.devin.ai/sessions/712bf9af5b9541129150746b33b0f1dc
Requested by: @oneky

- NewBingGoGoClientWebSocket: Add logging to onMessage, onClose, and onError
  catch blocks that were previously empty or silent
- NewBingGoGoServerWebSocket: Add logging for ping failures and onException
- NewBingGoGoServer: Log failures in error WebSocket, guard against null
  headers, handle missing Content-Length and premature stream EOF gracefully
- Add SLF4J Logger to all application classes for consistent diagnostics

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@oneky oneky self-assigned this Jun 24, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@oneky

oneky commented Jun 24, 2026 via email

Copy link
Copy Markdown
Owner

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