Add IsNotWsError method to WSConn#496
Conversation
Ignore normal closure errors
Coverage Report for CI Build 25046437266Coverage decreased (-0.06%) to 58.688%Details
Uncovered Changes
Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ae8e7aa. Configure here.
| func (c *WSConn) GetNextMessage() (b []byte, err error) { | ||
| _, msgBytes, err := c.conn.ReadMessage() | ||
| if err != nil { | ||
| if err != nil && c.IsNotWsError(err) { |
There was a problem hiding this comment.
Normal closure becomes misleading invalid header error
High Severity
The IsNotWsError check prevents GetNextMessage from returning normal websocket close errors (1000/1001). Instead, it proceeds with an empty message, returning packet.ErrInvalidPomeloHeader. This causes the session handler to log an Errorf for normal client disconnects, which is contrary to the PR's goal of silent handling and diverges from the TCP acceptor's clean close behavior.
Reviewed by Cursor Bugbot for commit ae8e7aa. Configure here.
There was a problem hiding this comment.
It seems the AI didn't see the internal implementation of the IsNotWsError method, which led to the opposite conclusion.


Ignore normal closure errors
Note
Low Risk
Low risk: only changes error handling in
WSConn.GetNextMessageto suppress expected close codes; main risk is masking unexpected shutdowns if callers relied on those errors.Overview
WebSocket reads now ignore normal close events. A new
WSConn.IsNotWsErrorhelper treats close codes1000(normal closure) and1001(going away) as non-errors.WSConn.GetNextMessagenow returns an error fromReadMessageonly when it is not one of those normal closure conditions, reducing noisy errors on routine disconnects.Reviewed by Cursor Bugbot for commit ae8e7aa. Bugbot is set up for automated code reviews on this repo. Configure here.