Compare commits
No commits in common. "3bacef551ee8656e802e14b231a725f146540ad8" and "cbc84c0126dc12ff3c1560034b02638ce262224d" have entirely different histories.
3bacef551e
...
cbc84c0126
40
README.md
40
README.md
|
@ -1,14 +1,11 @@
|
|||
# go-errhttp
|
||||
|
||||
Package **errhttp** provides errors and types that make dealing with HTTP response errors easier, for the Go programming language.
|
||||
Package **errhttp** provides types errors that make dealing with HTTP response errors easier, for the Go programming language.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
Here is an example of wrapping an error:
|
||||
|
||||
```go
|
||||
import "sourcecode.social/reiver/go-errhttp"
|
||||
import "github.com/reiver/go-errhttp"
|
||||
|
||||
// ...
|
||||
|
||||
|
@ -36,37 +33,8 @@ Here is an example of wrapping an error:
|
|||
}
|
||||
```
|
||||
|
||||
Here is an example of using one of the package global variable errors:
|
||||
|
||||
```go
|
||||
import "sourcecode.social/reiver/go-errhttp"
|
||||
|
||||
// ...
|
||||
|
||||
return errhttp.ErrBadRequest
|
||||
|
||||
// ...
|
||||
|
||||
switch err.(type) {
|
||||
case errhttp.BadRequest:
|
||||
//@TODO
|
||||
case errhttp.NotFound:
|
||||
//@TODO
|
||||
case errhttp.InternalServerError:
|
||||
//@TODO
|
||||
|
||||
case errhttp.ClientError:
|
||||
//@TODO
|
||||
case errhttp.ServerError:
|
||||
//@TODO
|
||||
|
||||
default:
|
||||
//@TODO
|
||||
}
|
||||
```
|
||||
|
||||
## Documention
|
||||
|
||||
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-errhttp
|
||||
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-errhttp
|
||||
|
||||
[![GoDoc](https://godoc.org/sourcecode.social/reiver/go-errhttp?status.svg)](https://godoc.org/sourcecode.social/reiver/go-errhttp)
|
||||
[![GoDoc](https://godoc.org/github.com/reiver/go-errhttp?status.svg)](https://godoc.org/github.com/reiver/go-errhttp)
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalBadGateway{}
|
||||
var _ ServerError = internalBadGateway{}
|
||||
var _ BadGateway = internalBadGateway{}
|
||||
|
||||
var ErrBadGateway error = BadGatewayWrap(nil)
|
||||
|
||||
type BadGateway interface {
|
||||
ServerError
|
||||
BadGateway()
|
||||
}
|
||||
|
||||
var _ BadGateway = internalBadGateway{}
|
||||
|
||||
type internalBadGateway struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalBadGateway) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalBadGateway) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalBadGateway) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalBadGateway) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalBadGateway) ServerError() {
|
|||
func (internalBadGateway) BadGateway() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalBadGateway) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalBadRequest{}
|
||||
var _ ClientError = internalBadRequest{}
|
||||
var _ BadRequest = internalBadRequest{}
|
||||
|
||||
var ErrBadRequest = BadRequestWrap(nil)
|
||||
|
||||
type BadRequest interface {
|
||||
ClientError
|
||||
BadRequest()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalBadRequest) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalBadRequest) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalBadRequest) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalBadRequest) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalBadRequest) ClientError() {
|
|||
func (internalBadRequest) BadRequest() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalBadRequest) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBadRequest(t *testing.T) {
|
||||
|
||||
var x BadRequest = internalBadRequest{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestClientError(t *testing.T) {
|
||||
|
||||
var x ClientError
|
||||
|
||||
x = internalBadRequest{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalUnauthorized{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalPaymentRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalForbidden{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalNotFound{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalMethodNotAllowed{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalNotAcceptable{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalProxyAuthRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalRequestTimeout{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalConflict{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalGone{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalLengthRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalPreconditionFailed{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalRequestEntityTooLarge{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalRequestURITooLong{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalUnsupportedMediaType{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalRequestedRangeNotSatisfiable{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalExpectationFailed{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalTeapot{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalUnprocessableEntity{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalLocked{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalFailedDependency{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalUpgradeRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalPreconditionRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalTooManyRequests{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalRequestHeaderFieldsTooLarge{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalUnavailableForLegalReasons{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should never happen.")
|
||||
}
|
||||
}
|
14
conflict.go
14
conflict.go
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalConflict{}
|
||||
var _ ClientError = internalConflict{}
|
||||
var _ Conflict = internalConflict{}
|
||||
|
||||
var ErrConflict = ConflictWrap(nil)
|
||||
|
||||
type Conflict interface {
|
||||
ClientError
|
||||
Conflict()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalConflict) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalConflict) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalConflict) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalConflict) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalConflict) ClientError() {
|
|||
func (internalConflict) Conflict() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalConflict) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConflict(t *testing.T) {
|
||||
|
||||
var x Conflict = internalConflict{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Package errhttp provides types errors that make dealing with HTTP response errors easier.
|
||||
|
||||
Example
|
||||
|
||||
import "github.com/reiver/go-errhttp"
|
||||
|
||||
// ...
|
||||
|
||||
if err := something(); nil != err {
|
||||
return errhttp.BadRequestWrap(err)
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
switch err.(type) {
|
||||
case errhttp.BadRequest:
|
||||
//@TODO
|
||||
case errhttp.NotFound:
|
||||
//@TODO
|
||||
case errhttp.InternalServerError:
|
||||
//@TODO
|
||||
|
||||
case errhttp.ClientError:
|
||||
//@TODO
|
||||
case errhttp.ServerError:
|
||||
//@TODO
|
||||
|
||||
default:
|
||||
//@TODO
|
||||
}
|
||||
*/
|
||||
package errhttp
|
3
error.go
3
error.go
|
@ -2,6 +2,5 @@ package errhttp
|
|||
|
||||
type Error interface {
|
||||
error
|
||||
ErrHTTP()
|
||||
Unwrap() error
|
||||
Err() error
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalExpectationFailed{}
|
||||
var _ ClientError = internalExpectationFailed{}
|
||||
var _ ExpectationFailed = internalExpectationFailed{}
|
||||
|
||||
var ErrExpectationFailed error = ExpectationFailedWrap(nil)
|
||||
|
||||
type ExpectationFailed interface {
|
||||
ClientError
|
||||
ExpectationFailed()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalExpectationFailed) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalExpectationFailed) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalExpectationFailed) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalExpectationFailed) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalExpectationFailed) ClientError() {
|
|||
func (internalExpectationFailed) ExpectationFailed() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalExpectationFailed) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExpectationFailed(t *testing.T) {
|
||||
|
||||
var x ExpectationFailed = internalExpectationFailed{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalFailedDependency{}
|
||||
var _ ClientError = internalFailedDependency{}
|
||||
var _ FailedDependency = internalFailedDependency{}
|
||||
|
||||
var ErrFailedDependency error = FailedDependencyWrap(nil)
|
||||
|
||||
type FailedDependency interface {
|
||||
ClientError
|
||||
FailedDependency()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalFailedDependency) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalFailedDependency) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalFailedDependency) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalFailedDependency) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalFailedDependency) FailedDependency() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalFailedDependency) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFailedDependency(t *testing.T) {
|
||||
|
||||
var x FailedDependency = internalFailedDependency{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
13
forbidden.go
13
forbidden.go
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalForbidden{}
|
||||
var _ ClientError = internalForbidden{}
|
||||
var _ Forbidden = internalForbidden{}
|
||||
|
||||
var ErrForbidden error = ForbiddenWrap(nil)
|
||||
|
||||
type Forbidden interface {
|
||||
ClientError
|
||||
Forbidden()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalForbidden) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalForbidden) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalForbidden) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalForbidden) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalForbidden) Forbidden() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalForbidden) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestForbidden(t *testing.T) {
|
||||
|
||||
var x Forbidden = internalForbidden{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalGatewayTimeout{}
|
||||
var _ ServerError = internalGatewayTimeout{}
|
||||
var _ GatewayTimeout = internalGatewayTimeout{}
|
||||
|
||||
var ErrGatewayTimeout error = GatewayTimeoutWrap(nil)
|
||||
|
||||
type GatewayTimeout interface {
|
||||
ServerError
|
||||
GatewayTimeout()
|
||||
}
|
||||
|
||||
var _ GatewayTimeout = internalGatewayTimeout{}
|
||||
|
||||
type internalGatewayTimeout struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalGatewayTimeout) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalGatewayTimeout) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalGatewayTimeout) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalGatewayTimeout) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalGatewayTimeout) ServerError() {
|
|||
func (internalGatewayTimeout) GatewayTimeout() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalGatewayTimeout) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
13
gone.go
13
gone.go
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalGone{}
|
||||
var _ ClientError = internalGone{}
|
||||
var _ Gone = internalGone{}
|
||||
|
||||
var ErrGone error = GoneWrap(nil)
|
||||
|
||||
type Gone interface {
|
||||
ClientError()
|
||||
Gone()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalGone) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalGone) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalGone) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalGone) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalGone) Gone() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalGone) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGone(t *testing.T) {
|
||||
|
||||
var x Gone = internalGone{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalHTTPVersionNotSupported{}
|
||||
var _ ServerError = internalHTTPVersionNotSupported{}
|
||||
var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{}
|
||||
|
||||
var ErrHTTPVersionNotSupported error = HTTPVersionNotSupportedWrap(nil)
|
||||
|
||||
type HTTPVersionNotSupported interface {
|
||||
ServerError
|
||||
HTTPVersionNotSupported()
|
||||
}
|
||||
|
||||
var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{}
|
||||
|
||||
type internalHTTPVersionNotSupported struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalHTTPVersionNotSupported) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalHTTPVersionNotSupported) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalHTTPVersionNotSupported) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalHTTPVersionNotSupported) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalHTTPVersionNotSupported) ServerError() {
|
|||
func (internalHTTPVersionNotSupported) HTTPVersionNotSupported() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalHTTPVersionNotSupported) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalInsufficientStorage{}
|
||||
var _ ServerError = internalInsufficientStorage{}
|
||||
var _ InsufficientStorage = internalInsufficientStorage{}
|
||||
|
||||
var ErrInsufficientStorage error = InsufficientStorageWrap(nil)
|
||||
|
||||
type InsufficientStorage interface {
|
||||
ServerError
|
||||
InsufficientStorage()
|
||||
}
|
||||
|
||||
var _ InsufficientStorage = internalInsufficientStorage{}
|
||||
|
||||
type internalInsufficientStorage struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalInsufficientStorage) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalInsufficientStorage) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalInsufficientStorage) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalInsufficientStorage) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalInsufficientStorage) ServerError() {
|
|||
func (internalInsufficientStorage) InsufficientStorage() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalInsufficientStorage) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalInternalServerError{}
|
||||
var _ ServerError = internalInternalServerError{}
|
||||
var _ InternalServerError = internalInternalServerError{}
|
||||
|
||||
var ErrInternalServerError error = InternalServerErrorWrap(nil)
|
||||
|
||||
type InternalServerError interface {
|
||||
ServerError
|
||||
InternalServerError()
|
||||
}
|
||||
|
||||
var _ InternalServerError = internalInternalServerError{}
|
||||
|
||||
type internalInternalServerError struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalInternalServerError) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalInternalServerError) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalInternalServerError) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalInternalServerError) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalInternalServerError) ServerError() {
|
|||
func (internalInternalServerError) InternalServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalInternalServerError) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalLengthRequired{}
|
||||
var _ ClientError = internalLengthRequired{}
|
||||
var _ LengthRequired = internalLengthRequired{}
|
||||
|
||||
var ErrLengthRequired error = LengthRequiredWrap(nil)
|
||||
|
||||
type LengthRequired interface {
|
||||
ClientError
|
||||
LengthRequired()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalLengthRequired) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalLengthRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalLengthRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLengthRequired) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalLengthRequired) LengthRequired() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalLengthRequired) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLengthRequired(t *testing.T) {
|
||||
|
||||
var x LengthRequired = internalLengthRequired{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
14
locked.go
14
locked.go
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalLocked{}
|
||||
var _ ClientError = internalLocked{}
|
||||
var _ Locked = internalLocked{}
|
||||
|
||||
var ErrLocked error = LockedWrap(nil)
|
||||
|
||||
type Locked interface {
|
||||
ClientError
|
||||
Locked()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalLocked) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalLocked) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalLocked) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLocked) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalLocked) ClientError() {
|
|||
func (internalLocked) Locked() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalLocked) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLocked(t *testing.T) {
|
||||
|
||||
var x Locked = internalLocked{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalLoopDetected{}
|
||||
var _ ServerError = internalLoopDetected{}
|
||||
var _ LoopDetected = internalLoopDetected{}
|
||||
|
||||
var ErrLoopDetected error = LoopDetectedWrap(nil)
|
||||
|
||||
type LoopDetected interface {
|
||||
ServerError
|
||||
LoopDetected()
|
||||
}
|
||||
|
||||
var _ LoopDetected = internalLoopDetected{}
|
||||
|
||||
type internalLoopDetected struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalLoopDetected) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalLoopDetected) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalLoopDetected) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLoopDetected) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalLoopDetected) ServerError() {
|
|||
func (internalLoopDetected) LoopDetected() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalLoopDetected) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalMethodNotAllowed{}
|
||||
var _ ClientError = internalMethodNotAllowed{}
|
||||
var _ MethodNotAllowed = internalMethodNotAllowed{}
|
||||
|
||||
var ErrMethodNotAllowed error = MethodNotAllowedWrap(nil)
|
||||
|
||||
type MethodNotAllowed interface {
|
||||
ClientError
|
||||
MethodNotAllowed()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalMethodNotAllowed) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalMethodNotAllowed) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalMethodNotAllowed) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalMethodNotAllowed) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalMethodNotAllowed) MethodNotAllowed() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalMethodNotAllowed) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMethodNotAllowed(t *testing.T) {
|
||||
|
||||
var x MethodNotAllowed = internalMethodNotAllowed{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalNetworkAuthenticationRequired{}
|
||||
var _ ServerError = internalNetworkAuthenticationRequired{}
|
||||
var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{}
|
||||
|
||||
var ErrNetworkAuthenticationRequired error = NetworkAuthenticationRequiredWrap(nil)
|
||||
|
||||
type NetworkAuthenticationRequired interface {
|
||||
ServerError
|
||||
NetworkAuthenticationRequired()
|
||||
}
|
||||
|
||||
var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{}
|
||||
|
||||
type internalNetworkAuthenticationRequired struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalNetworkAuthenticationRequired) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalNetworkAuthenticationRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalNetworkAuthenticationRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNetworkAuthenticationRequired) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalNetworkAuthenticationRequired) ServerError() {
|
|||
func (internalNetworkAuthenticationRequired) NetworkAuthenticationRequired() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalNetworkAuthenticationRequired) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalNotAcceptable{}
|
||||
var _ ClientError = internalNotAcceptable{}
|
||||
var _ NotAcceptable = internalNotAcceptable{}
|
||||
|
||||
var ErrNotAcceptable error = NotAcceptableWrap(nil)
|
||||
|
||||
type NotAcceptable interface {
|
||||
ClientError
|
||||
NotAcceptable()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalNotAcceptable) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalNotAcceptable) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalNotAcceptable) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotAcceptable) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalNotAcceptable) ClientError() {
|
|||
func (internalNotAcceptable) NotAcceptable() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalNotAcceptable) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNotAcceptable(t *testing.T) {
|
||||
|
||||
var x NotAcceptable = internalNotAcceptable{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalNotExtended{}
|
||||
var _ ServerError = internalNotExtended{}
|
||||
var _ NotExtended = internalNotExtended{}
|
||||
|
||||
var ErrNotExtended error = NotExtendedWrap(nil)
|
||||
|
||||
type NotExtended interface {
|
||||
ServerError
|
||||
NotExtended()
|
||||
}
|
||||
|
||||
var _ NotExtended = internalNotExtended{}
|
||||
|
||||
type internalNotExtended struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalNotExtended) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalNotExtended) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalNotExtended) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotExtended) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalNotExtended) ServerError() {
|
|||
func (internalNotExtended) NotExtended() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalNotExtended) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
14
notfound.go
14
notfound.go
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalNotFound{}
|
||||
var _ ClientError = internalNotFound{}
|
||||
var _ NotFound = internalNotFound{}
|
||||
|
||||
var ErrNotFound error = NotFoundWrap(nil)
|
||||
|
||||
type NotFound interface {
|
||||
ClientError
|
||||
NotFound ()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalNotFound ) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalNotFound ) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalNotFound ) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotFound ) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalNotFound ) ClientError() {
|
|||
func (internalNotFound ) NotFound() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalNotFound) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNotFound(t *testing.T) {
|
||||
|
||||
var x NotFound = internalNotFound{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalNotImplemented{}
|
||||
var _ ServerError = internalNotImplemented{}
|
||||
var _ NotImplemented = internalNotImplemented{}
|
||||
|
||||
var ErrNotImplemented error = NotImplementedWrap(nil)
|
||||
|
||||
type NotImplemented interface {
|
||||
ServerError
|
||||
NotImplemented()
|
||||
}
|
||||
|
||||
var _ NotImplemented = internalNotImplemented{}
|
||||
|
||||
type internalNotImplemented struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalNotImplemented) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalNotImplemented) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalNotImplemented) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotImplemented) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalNotImplemented) ServerError() {
|
|||
func (internalNotImplemented) NotImplemented() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalNotImplemented) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalPayloadTooLarge{}
|
||||
var _ ClientError = internalPayloadTooLarge{}
|
||||
var _ PayloadTooLarge = internalPayloadTooLarge{}
|
||||
|
||||
var ErrPayloadTooLarge error = PayloadTooLargeWrap(nil)
|
||||
|
||||
type PayloadTooLarge interface {
|
||||
ClientError
|
||||
PayloadTooLarge()
|
||||
}
|
||||
|
||||
type internalPayloadTooLarge struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func PayloadTooLargeWrap(err error) error {
|
||||
return internalPayloadTooLarge{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalPayloadTooLarge) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalPayloadTooLarge) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPayloadTooLarge) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPayloadTooLarge) PayloadTooLarge() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalPayloadTooLarge) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalPaymentRequired{}
|
||||
var _ ClientError = internalPaymentRequired{}
|
||||
var _ PaymentRequired = internalPaymentRequired{}
|
||||
|
||||
var ErrPaymentRequired error = PaymentRequiredWrap(nil)
|
||||
|
||||
type PaymentRequired interface {
|
||||
ClientError
|
||||
PaymentRequired()
|
||||
|
@ -25,11 +19,10 @@ func (receiver internalPaymentRequired) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalPaymentRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalPaymentRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
|
||||
func (internalPaymentRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
@ -37,7 +30,3 @@ func (internalPaymentRequired) ClientError() {
|
|||
func (internalPaymentRequired) PaymentRequired() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalPaymentRequired) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPaymentRequired(t *testing.T) {
|
||||
|
||||
var x PaymentRequired = internalPaymentRequired{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalPreconditionFailed{}
|
||||
var _ ClientError = internalPreconditionFailed{}
|
||||
var _ PreconditionFailed = internalPreconditionFailed{}
|
||||
|
||||
var ErrPreconditionFailed error = PreconditionFailedWrap(nil)
|
||||
|
||||
type PreconditionFailed interface {
|
||||
ClientError
|
||||
PreconditionFailed()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalPreconditionFailed) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalPreconditionFailed) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalPreconditionFailed) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPreconditionFailed) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalPreconditionFailed) ClientError() {
|
|||
func (internalPreconditionFailed) PreconditionFailed() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalPreconditionFailed) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPreconditionFailed(t *testing.T) {
|
||||
|
||||
var x PreconditionFailed = internalPreconditionFailed{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalPreconditionRequired{}
|
||||
var _ ClientError = internalPreconditionRequired{}
|
||||
var _ PreconditionRequired = internalPreconditionRequired{}
|
||||
|
||||
var ErrPreconditionRequired error = PreconditionRequiredWrap(nil)
|
||||
|
||||
type PreconditionRequired interface {
|
||||
ClientError
|
||||
PreconditionRequired()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalPreconditionRequired) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalPreconditionRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalPreconditionRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPreconditionRequired) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalPreconditionRequired) PreconditionRequired() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalPreconditionRequired) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPreconditionRequired(t *testing.T) {
|
||||
|
||||
var x PreconditionRequired = internalPreconditionRequired{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalProxyAuthRequired{}
|
||||
var _ ClientError = internalProxyAuthRequired{}
|
||||
var _ ProxyAuthRequired = internalProxyAuthRequired{}
|
||||
|
||||
var ErrProxyAuthRequired error = ProxyAuthRequiredWrap(nil)
|
||||
|
||||
type ProxyAuthRequired interface {
|
||||
ClientError
|
||||
ProxyAuthRequired()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalProxyAuthRequired) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalProxyAuthRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalProxyAuthRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalProxyAuthRequired) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalProxyAuthRequired) ClientError() {
|
|||
func (internalProxyAuthRequired) ProxyAuthRequired() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalProxyAuthRequired) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestProxyAuthRequired(t *testing.T) {
|
||||
|
||||
var x ProxyAuthRequired = internalProxyAuthRequired{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalRequestedRangeNotSatisfiable{}
|
||||
var _ ClientError = internalRequestedRangeNotSatisfiable{}
|
||||
var _ RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{}
|
||||
|
||||
var ErrRequestedRangeNotSatisfiable error = RequestedRangeNotSatisfiableWrap(nil)
|
||||
|
||||
type RequestedRangeNotSatisfiable interface {
|
||||
ClientError
|
||||
RequestedRangeNotSatisfiable()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalRequestedRangeNotSatisfiable) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalRequestedRangeNotSatisfiable) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalRequestedRangeNotSatisfiable) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestedRangeNotSatisfiable) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalRequestedRangeNotSatisfiable) ClientError() {
|
|||
func (internalRequestedRangeNotSatisfiable) RequestedRangeNotSatisfiable() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalRequestedRangeNotSatisfiable) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRequestedRangeNotSatisfiable(t *testing.T) {
|
||||
|
||||
var x RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalRequestEntityTooLarge{}
|
||||
var _ ClientError = internalRequestEntityTooLarge{}
|
||||
var _ RequestEntityTooLarge = internalRequestEntityTooLarge{}
|
||||
|
||||
var ErrRequestEntityTooLarge error = RequestEntityTooLargeWrap(nil)
|
||||
|
||||
type RequestEntityTooLarge interface {
|
||||
ClientError
|
||||
RequestEntityTooLarge()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalRequestEntityTooLarge) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalRequestEntityTooLarge) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalRequestEntityTooLarge) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestEntityTooLarge) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalRequestEntityTooLarge) ClientError() {
|
|||
func (internalRequestEntityTooLarge) RequestEntityTooLarge() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalRequestEntityTooLarge) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRequestEntityTooLarge(t *testing.T) {
|
||||
|
||||
var x RequestEntityTooLarge = internalRequestEntityTooLarge{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,13 +1,8 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalRequestHeaderFieldsTooLarge{}
|
||||
var _ ClientError = internalRequestHeaderFieldsTooLarge{}
|
||||
var _ RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{}
|
||||
|
||||
var ErrRequestHeaderFieldsTooLarge error = RequestHeaderFieldsTooLargeWrap(nil)
|
||||
|
||||
type RequestHeaderFieldsTooLarge interface {
|
||||
ClientError
|
||||
error
|
||||
Err() error
|
||||
RequestHeaderFieldsTooLarge()
|
||||
}
|
||||
|
||||
|
@ -25,8 +20,8 @@ func (receiver internalRequestHeaderFieldsTooLarge) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalRequestHeaderFieldsTooLarge) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalRequestHeaderFieldsTooLarge) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestHeaderFieldsTooLarge) ClientError() {
|
||||
|
@ -36,7 +31,3 @@ func (internalRequestHeaderFieldsTooLarge) ClientError() {
|
|||
func (internalRequestHeaderFieldsTooLarge) RequestHeaderFieldsTooLarge() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalRequestHeaderFieldsTooLarge) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRequestHeaderFieldsTooLarge(t *testing.T) {
|
||||
|
||||
var x RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,13 +1,8 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalRequestTimeout{}
|
||||
var _ ClientError = internalRequestTimeout{}
|
||||
var _ RequestTimeout = internalRequestTimeout{}
|
||||
|
||||
var ErrRequestTimeout error = RequestTimeoutWrap(nil)
|
||||
|
||||
type RequestTimeout interface {
|
||||
ClientError
|
||||
error
|
||||
Err() error
|
||||
RequestTimeout()
|
||||
}
|
||||
|
||||
|
@ -25,8 +20,8 @@ func (receiver internalRequestTimeout) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalRequestTimeout) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalRequestTimeout) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestTimeout) ClientError() {
|
||||
|
@ -36,7 +31,3 @@ func (internalRequestTimeout) ClientError() {
|
|||
func (internalRequestTimeout) RequestTimeout() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalRequestTimeout) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRequestTimeout(t *testing.T) {
|
||||
|
||||
var x RequestTimeout = internalRequestTimeout{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,13 +1,8 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalRequestURITooLong{}
|
||||
var _ ClientError = internalRequestURITooLong{}
|
||||
var _ RequestURITooLong = internalRequestURITooLong{}
|
||||
|
||||
var ErrRequestURITooLong error = RequestURITooLongWrap(nil)
|
||||
|
||||
type RequestURITooLong interface {
|
||||
ClientError
|
||||
error
|
||||
Err() error
|
||||
RequestURITooLong()
|
||||
}
|
||||
|
||||
|
@ -25,8 +20,8 @@ func (receiver internalRequestURITooLong) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalRequestURITooLong) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalRequestURITooLong) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestURITooLong) ClientError() {
|
||||
|
@ -36,7 +31,3 @@ func (internalRequestURITooLong) ClientError() {
|
|||
func (internalRequestURITooLong) RequestURITooLong() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalRequestURITooLong) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRequestURITooLong(t *testing.T) {
|
||||
|
||||
var x RequestURITooLong = internalRequestURITooLong{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestServerError(t *testing.T) {
|
||||
|
||||
var x ServerError
|
||||
|
||||
x = internalInternalServerError{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalNotImplemented{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalBadGateway{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalServiceUnavailable{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalGatewayTimeout{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalHTTPVersionNotSupported{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalVariantAlsoNegotiates{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalInsufficientStorage{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalLoopDetected{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalNotExtended{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
x = internalNetworkAuthenticationRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should never happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalServiceUnavailable{}
|
||||
var _ ServerError = internalServiceUnavailable{}
|
||||
var _ ServiceUnavailable = internalServiceUnavailable{}
|
||||
|
||||
var ErrServiceUnavailable error = ServiceUnavailableWrap(nil)
|
||||
|
||||
type ServiceUnavailable interface {
|
||||
ServerError
|
||||
ServiceUnavailable()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalServiceUnavailable) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalServiceUnavailable) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalServiceUnavailable) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalServiceUnavailable) ServerError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalServiceUnavailable) ServerError() {
|
|||
func (internalServiceUnavailable) ServiceUnavailable() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalServiceUnavailable) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
14
teapot.go
14
teapot.go
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalTeapot{}
|
||||
var _ ClientError = internalTeapot{}
|
||||
var _ Teapot = internalTeapot{}
|
||||
|
||||
var ErrTeapot error = TeapotWrap(nil)
|
||||
|
||||
type Teapot interface {
|
||||
ClientError
|
||||
Teapot()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalTeapot) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalTeapot) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalTeapot) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalTeapot) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalTeapot) ClientError() {
|
|||
func (internalTeapot) Teapot() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalTeapot) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTeapot(t *testing.T) {
|
||||
|
||||
var x Teapot = internalTeapot{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalTooManyRequests{}
|
||||
var _ ClientError = internalTooManyRequests{}
|
||||
var _ TooManyRequests = internalTooManyRequests{}
|
||||
|
||||
var ErrTooManyRequests error = TooManyRequestsWrap(nil)
|
||||
|
||||
type TooManyRequests interface {
|
||||
ClientError
|
||||
TooManyRequests()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalTooManyRequests) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalTooManyRequests) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalTooManyRequests) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalTooManyRequests) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalTooManyRequests) ClientError() {
|
|||
func (internalTooManyRequests) TooManyRequests() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalTooManyRequests) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTooManyRequests(t *testing.T) {
|
||||
|
||||
var x TooManyRequests = internalTooManyRequests{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalUnauthorized{}
|
||||
var _ ClientError = internalUnauthorized{}
|
||||
var _ Unauthorized = internalUnauthorized{}
|
||||
|
||||
var ErrUnauthorized error = UnauthorizedWrap(nil)
|
||||
|
||||
type Unauthorized interface {
|
||||
ClientError
|
||||
Unauthorized()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalUnauthorized) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalUnauthorized) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalUnauthorized) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnauthorized) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalUnauthorized) ClientError() {
|
|||
func (internalUnauthorized) Unauthorized() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalUnauthorized) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnauthorized(t *testing.T) {
|
||||
|
||||
var x Unauthorized = internalUnauthorized{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalUnavailableForLegalReasons{}
|
||||
var _ ClientError = internalUnavailableForLegalReasons{}
|
||||
var _ UnavailableForLegalReasons = internalUnavailableForLegalReasons{}
|
||||
|
||||
var ErrUnavailableForLegalReasons error = UnavailableForLegalReasonsWrap(nil)
|
||||
|
||||
type UnavailableForLegalReasons interface {
|
||||
ClientError
|
||||
UnavailableForLegalReasons()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalUnavailableForLegalReasons) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalUnavailableForLegalReasons) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalUnavailableForLegalReasons) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnavailableForLegalReasons) ClientError() {
|
||||
|
@ -37,6 +31,3 @@ func (internalUnavailableForLegalReasons) UnavailableForLegalReasons() {
|
|||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalUnavailableForLegalReasons) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnavailableForLegalReasons(t *testing.T) {
|
||||
|
||||
var x UnavailableForLegalReasons = internalUnavailableForLegalReasons{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalUnprocessableEntity{}
|
||||
var _ ClientError = internalUnprocessableEntity{}
|
||||
var _ UnprocessableEntity = internalUnprocessableEntity{}
|
||||
|
||||
var ErrUnprocessableEntity error = UnprocessableEntityWrap(nil)
|
||||
|
||||
type UnprocessableEntity interface {
|
||||
ClientError
|
||||
UnprocessableEntity()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalUnprocessableEntity) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalUnprocessableEntity) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalUnprocessableEntity) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnprocessableEntity) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalUnprocessableEntity) ClientError() {
|
|||
func (internalUnprocessableEntity) UnprocessableEntity() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalUnprocessableEntity) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnprocessableEntity(t *testing.T) {
|
||||
|
||||
var x UnprocessableEntity = internalUnprocessableEntity{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalUnsupportedMediaType{}
|
||||
var _ ClientError = internalUnsupportedMediaType{}
|
||||
var _ UnsupportedMediaType = internalUnsupportedMediaType{}
|
||||
|
||||
var ErrUnsupportedMediaType error = UnsupportedMediaTypeWrap(nil)
|
||||
|
||||
type UnsupportedMediaType interface {
|
||||
ClientError
|
||||
UnsupportedMediaType()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalUnsupportedMediaType) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalUnsupportedMediaType) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalUnsupportedMediaType) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnsupportedMediaType) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalUnsupportedMediaType) ClientError() {
|
|||
func (internalUnsupportedMediaType) UnsupportedMediaType() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalUnsupportedMediaType) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnsupportedMediaType(t *testing.T) {
|
||||
|
||||
var x UnsupportedMediaType = internalUnsupportedMediaType{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalUpgradeRequired{}
|
||||
var _ ClientError = internalUpgradeRequired{}
|
||||
var _ UpgradeRequired = internalUpgradeRequired{}
|
||||
|
||||
var ErrUpgradeRequired error = UpgradeRequiredWrap(nil)
|
||||
|
||||
type UpgradeRequired interface {
|
||||
ClientError
|
||||
UpgradeRequired()
|
||||
|
@ -25,8 +19,8 @@ func (receiver internalUpgradeRequired) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalUpgradeRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalUpgradeRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUpgradeRequired) ClientError() {
|
||||
|
@ -36,7 +30,3 @@ func (internalUpgradeRequired) ClientError() {
|
|||
func (internalUpgradeRequired) UpgradeRequired() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalUpgradeRequired) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package errhttp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUpgradeRequired(t *testing.T) {
|
||||
|
||||
var x UpgradeRequired = internalUpgradeRequired{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
|
||||
|
||||
if nil == x {
|
||||
t.Errorf("This should not happen.")
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalURITooLong{}
|
||||
var _ ClientError = internalURITooLong{}
|
||||
var _ URITooLong = internalURITooLong{}
|
||||
|
||||
var ErrURITooLong error = URITooLongWrap(nil)
|
||||
|
||||
type URITooLong interface {
|
||||
ClientError
|
||||
URITooLong()
|
||||
}
|
||||
|
||||
type internalURITooLong struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func URITooLongWrap(err error) error {
|
||||
return internalURITooLong{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalURITooLong) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalURITooLong) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalURITooLong) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalURITooLong) URITooLong() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalURITooLong) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package errhttp
|
||||
|
||||
var _ Error = internalVariantAlsoNegotiates{}
|
||||
var _ ServerError = internalVariantAlsoNegotiates{}
|
||||
var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{}
|
||||
|
||||
var ErrVariantAlsoNegotiates error = VariantAlsoNegotiatesWrap(nil)
|
||||
|
||||
type VariantAlsoNegotiates interface {
|
||||
ServerError
|
||||
VariantAlsoNegotiates()
|
||||
}
|
||||
|
||||
var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{}
|
||||
|
||||
type internalVariantAlsoNegotiates struct {
|
||||
err error
|
||||
}
|
||||
|
@ -27,8 +19,8 @@ func (receiver internalVariantAlsoNegotiates) Error() string {
|
|||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (internalVariantAlsoNegotiates) ErrHTTP() {
|
||||
// Nothing here.
|
||||
func (receiver internalVariantAlsoNegotiates) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalVariantAlsoNegotiates) ServerError() {
|
||||
|
@ -38,7 +30,3 @@ func (internalVariantAlsoNegotiates) ServerError() {
|
|||
func (internalVariantAlsoNegotiates) VariantAlsoNegotiates() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (receiver internalVariantAlsoNegotiates) Unwrap() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue