mirror of
https://github.com/golang/go
synced 2024-09-25 09:20:18 -06:00
Add Unwrap to SystemRootsError
This commit is contained in:
parent
fbf62beb4e
commit
9a95bc6601
@ -187,6 +187,8 @@ func (se SystemRootsError) Error() string {
|
|||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (se SystemRootsError) Unwrap() error { return se.Err }
|
||||||
|
|
||||||
// errNotParsed is returned when a certificate without ASN.1 contents is
|
// errNotParsed is returned when a certificate without ASN.1 contents is
|
||||||
// verified. Platform-specific verification needs the ASN.1 contents.
|
// verified. Platform-specific verification needs the ASN.1 contents.
|
||||||
var errNotParsed = errors.New("x509: missing ASN.1 contents; use ParseCertificate")
|
var errNotParsed = errors.New("x509: missing ASN.1 contents; use ParseCertificate")
|
||||||
|
@ -2005,3 +2005,11 @@ func TestSystemRootsError(t *testing.T) {
|
|||||||
t.Errorf("error was not SystemRootsError: %v", err)
|
t.Errorf("error was not SystemRootsError: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSystemRootsErrorUnwrap(t *testing.T) {
|
||||||
|
var err1 = errors.New("err1")
|
||||||
|
err := SystemRootsError{Err: err1}
|
||||||
|
if !errors.Is(err, err1) {
|
||||||
|
t.Error("errors.Is failed, wanted success")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user