INNER CODE UNIT · Go
func
go-piv/go-ykpiv · errors.go:53
func (e Error) Equal(err error) bool {
otherError, ok := err.(Error)
if !ok {
return false
}
return e.Code == otherError.Code
}
// Error interface. This will sprintf a string containing where this error
// came from, the human message, and the underlying ykpiv code, to aid with
// debugging.
func (e Error) Error() string {
return fmt.Sprintf("%s: %s (%d) - %s", e.where, e.Message, e.Code,
C.GoString(C.ykpiv_strerror(C.ykpiv_rc(e.Code))))
}
// Create a helpful mapping between 8 bit integers and the Error that it
// belongs to. This is used to look errors up at runtime later.