crypto/tls: better error messages.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/60580046
This commit is contained in:
Adam Langley 2014-02-12 11:20:01 -05:00
parent 5e711b473c
commit 6b29f7bfbe
6 changed files with 90 additions and 49 deletions

View file

@ -9,6 +9,7 @@ import (
"crypto"
"crypto/rand"
"crypto/x509"
"fmt"
"io"
"math/big"
"strings"
@ -540,3 +541,7 @@ func initDefaultCipherSuites() {
varDefaultCipherSuites[i] = suite.id
}
}
func unexpectedMessageError(wanted, got interface{}) error {
return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted)
}