48 lines
780 B
Go
48 lines
780 B
Go
package errhttp
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var ErrRequestTimeout error = RequestTimeoutWrap(errors.New("Request Timeout"))
|
|
|
|
type RequestTimeout interface {
|
|
error
|
|
Err() error
|
|
RequestTimeout()
|
|
}
|
|
|
|
type internalRequestTimeout struct {
|
|
err error
|
|
}
|
|
|
|
func RequestTimeoutWrap(err error) error {
|
|
return internalRequestTimeout{
|
|
err:err,
|
|
}
|
|
}
|
|
|
|
func (receiver internalRequestTimeout) Error() string {
|
|
return receiver.err.Error()
|
|
}
|
|
|
|
func (receiver internalRequestTimeout) Err() error {
|
|
return receiver.err
|
|
}
|
|
|
|
func (internalRequestTimeout) ErrHTTP() {
|
|
// Nothing here.
|
|
}
|
|
|
|
func (internalRequestTimeout) ClientError() {
|
|
// Nothing here.
|
|
}
|
|
|
|
func (internalRequestTimeout) RequestTimeout() {
|
|
// Nothing here.
|
|
}
|
|
|
|
func (receiver internalRequestTimeout) Unwrap() error {
|
|
return receiver.err
|
|
}
|