diff --git a/pkg/node/protocol_test.go b/pkg/node/protocol_test.go index 1d728a4..c20c5c2 100644 --- a/pkg/node/protocol_test.go +++ b/pkg/node/protocol_test.go @@ -1,7 +1,6 @@ package node import ( - "fmt" "testing" ) @@ -153,8 +152,14 @@ func TestConvenienceFunctions(t *testing.T) { } } +// testErr is a plain error type used to verify behaviour with non-ProtocolError values. +// err := &testErr{"context: operation failed"} +type testErr struct{ message string } + +func (e *testErr) Error() string { return e.message } + func TestGetProtocolErrorCode_NonProtocolError(t *testing.T) { - err := fmt.Errorf("regular error") + err := &testErr{"regular error"} if GetProtocolErrorCode(err) != 0 { t.Error("Expected 0 for non-ProtocolError") }