ax(node): replace prose ValidateResponse comment with usage example
Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
ba198731c2
commit
873ccaee7b
1 changed files with 1 additions and 5 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue