ax(node): replace prose ValidateResponse comment with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 07:47:37 +01:00
parent ba198731c2
commit 873ccaee7b
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -17,11 +17,7 @@ func (e *ProtocolError) Error() string {
// ResponseHandler provides helpers for handling protocol responses.
type ResponseHandler struct{}
// ValidateResponse checks if the response is valid and returns a parsed error if it's an error response.
// It checks:
// 1. If response is nil (returns error)
// 2. If response is an error message (returns ProtocolError)
// 3. If response type matches expected (returns error if not)
// if err := handler.ValidateResponse(resp, MsgPong); err != nil { return 0, err }
func (h *ResponseHandler) ValidateResponse(resp *Message, expectedType MessageType) error {
if resp == nil {
return fmt.Errorf("nil response")