go-errhttp/proxyauthrequired.go

53 lines
1.1 KiB
Go
Raw Permalink Normal View History

2017-02-06 20:58:13 +00:00
package errhttp
import (
"net/http"
)
var _ Error = internalProxyAuthRequired{}
var _ ClientError = internalProxyAuthRequired{}
var _ ProxyAuthRequired = internalProxyAuthRequired{}
var ClientErrorProxyAuthRequired ClientError = ProxyAuthRequiredWrap(nil).(ProxyAuthRequired)
var ErrHTTPProxyAuthRequired Error = ClientErrorProxyAuthRequired
var ErrProxyAuthRequired error = ClientErrorProxyAuthRequired
2017-02-06 20:58:13 +00:00
type ProxyAuthRequired interface {
ClientError
ProxyAuthRequired()
}
type internalProxyAuthRequired struct {
err error
}
func ProxyAuthRequiredWrap(err error) error {
return internalProxyAuthRequired{
err:err,
}
}
func (receiver internalProxyAuthRequired) Error() string {
2023-10-01 02:30:28 +00:00
err := receiver.err
if nil == err {
return http.StatusText(receiver.ErrHTTP())
}
return err.Error()
2017-02-06 20:58:13 +00:00
}
func (internalProxyAuthRequired) ErrHTTP() int {
return http.StatusProxyAuthRequired
}
2017-02-06 20:58:13 +00:00
func (internalProxyAuthRequired) ClientError() {
// Nothing here.
}
func (internalProxyAuthRequired) ProxyAuthRequired() {
// Nothing here.
}
func (receiver internalProxyAuthRequired) Unwrap() error {
return receiver.err
}