From: jsing Date: Sun, 9 Apr 2017 14:31:44 +0000 (+0000) Subject: Improve unknown protocol version handling. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3c9e0b2e8daf8831358101d228fc71ca6ecb6cb8;p=openbsd Improve unknown protocol version handling. --- 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.