From 3c9e0b2e8daf8831358101d228fc71ca6ecb6cb8 Mon Sep 17 00:00:00 2001 From: jsing Date: Sun, 9 Apr 2017 14:31:44 +0000 Subject: [PATCH] Improve unknown protocol version handling. --- regress/lib/libtls/gotls/tls.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/regress/lib/libtls/gotls/tls.go b/regress/lib/libtls/gotls/tls.go index 9b42b0aafcc..961dde13081 100644 --- a/regress/lib/libtls/gotls/tls.go +++ b/regress/lib/libtls/gotls/tls.go @@ -14,6 +14,7 @@ import "C" import ( "errors" + "fmt" "time" "unsafe" ) @@ -30,7 +31,7 @@ type ProtocolVersion uint32 func (pv ProtocolVersion) String() string { name, ok := protocolNames[pv] if !ok { - return "unknown protocol version" + return fmt.Sprintf("unknown protocol version %x", pv) } return name } @@ -56,7 +57,7 @@ func ProtocolVersionFromString(version string) (ProtocolVersion, error) { return proto, nil } } - return 0, errors.New("unknown protocol version") + return 0, fmt.Errorf("unknown protocol version %q", version) } // TLSConfig provides configuration options for a TLS context. -- 2.20.1