go-errhttp/upgraderequired.go

47 lines
788 B
Go
Raw Normal View History

2017-02-06 20:58:13 +00:00
package errhttp
import (
"errors"
)
var ErrUpgradeRequired error = UpgradeRequiredWrap(errors.New("Upgrade Required"))
2017-02-06 20:58:13 +00:00
type UpgradeRequired interface {
ClientError
UpgradeRequired()
}
type internalUpgradeRequired struct {
err error
}
func UpgradeRequiredWrap(err error) error {
return internalUpgradeRequired{
err:err,
}
}
func (receiver internalUpgradeRequired) Error() string {
return receiver.err.Error()
}
func (receiver internalUpgradeRequired) Err() error {
return receiver.err
}
func (internalUpgradeRequired) ErrHTTP() {
// Nothing here.
}
2017-02-06 20:58:13 +00:00
func (internalUpgradeRequired) ClientError() {
// Nothing here.
}
func (internalUpgradeRequired) UpgradeRequired() {
// Nothing here.
}
func (receiver internalUpgradeRequired) Unwrap() error {
return receiver.err
}