go-errhttp/gone.go

43 lines
571 B
Go
Raw Normal View History

2017-02-06 20:58:13 +00:00
package errhttp
import (
"errors"
)
var ErrGone error = GoneWrap(errors.New("Gone"))
2017-02-06 20:58:13 +00:00
type Gone interface {
ClientError()
Gone()
}
type internalGone struct {
err error
}
func GoneWrap(err error) error {
return internalGone{
err:err,
}
}
func (receiver internalGone) Error() string {
return receiver.err.Error()
}
func (receiver internalGone) Err() error {
return receiver.err
}
func (internalGone) ClientError() {
// Nothing here.
}
func (internalGone) Gone() {
// Nothing here.
}
func (receiver internalGone) Unwrap() error {
return receiver.err
}