Files
gemini-grc/gopher/errors.go

31 lines
554 B
Go

package gopher
import "github.com/antanst/go_errors"
// GopherError is an error encountered while
// visiting a Gopher host, and is only for
// Gopher errors (item type indicator 3).
type GopherError struct {
Err error
}
func (e *GopherError) Error() string {
return e.Err.Error()
}
func (e *GopherError) Unwrap() error {
return e.Err
}
func NewGopherError(err error) error {
return &GopherError{Err: err}
}
func IsGopherError(err error) bool {
if err == nil {
return false
}
var asError *GopherError
return go_errors.As(err, &asError)
}