client errors
parent
6f7fbc0035
commit
c38ee02a49
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type BadRequest interface {
|
||||
ClientError
|
||||
BadRequest()
|
||||
}
|
||||
|
||||
type internalBadRequest struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func BadRequestWrap(err error) error {
|
||||
return internalBadRequest{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalBadRequest) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalBadRequest) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalBadRequest) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalBadRequest) BadRequest() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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,6 @@
|
|||
package errhttp
|
||||
|
||||
type ClientError interface {
|
||||
Error
|
||||
ClientError()
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type Conflict interface {
|
||||
ClientError
|
||||
Conflict()
|
||||
}
|
||||
|
||||
type internalConflict struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func ConflictWrap(err error) error {
|
||||
return internalConflict{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalConflict) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalConflict) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalConflict) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalConflict) Conflict() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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,6 @@
|
|||
package errhttp
|
||||
|
||||
type Error interface {
|
||||
error
|
||||
Err() error
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type ExpectationFailed interface {
|
||||
ClientError
|
||||
ExpectationFailed()
|
||||
}
|
||||
|
||||
type internalExpectationFailed struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func ExpectationFailedWrap(err error) error {
|
||||
return internalExpectationFailed{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalExpectationFailed) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalExpectationFailed) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalExpectationFailed) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalExpectationFailed) ExpectationFailed() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type FailedDependency interface {
|
||||
ClientError
|
||||
FailedDependency()
|
||||
}
|
||||
|
||||
type internalFailedDependency struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func FailedDependencyWrap(err error) error {
|
||||
return internalFailedDependency{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalFailedDependency) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalFailedDependency) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalFailedDependency) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalFailedDependency) FailedDependency() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type Forbidden interface {
|
||||
ClientError
|
||||
Forbidden()
|
||||
}
|
||||
|
||||
type internalForbidden struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func ForbiddenWrap(err error) error {
|
||||
return internalForbidden{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalForbidden) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalForbidden) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalForbidden) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalForbidden) Forbidden() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
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.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type LengthRequired interface {
|
||||
ClientError
|
||||
LengthRequired()
|
||||
}
|
||||
|
||||
type internalLengthRequired struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func LengthRequiredWrap(err error) error {
|
||||
return internalLengthRequired{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalLengthRequired) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalLengthRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLengthRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalLengthRequired) LengthRequired() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type Locked interface {
|
||||
ClientError
|
||||
Locked()
|
||||
}
|
||||
|
||||
type internalLocked struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func LockedWrap(err error) error {
|
||||
return internalLocked{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalLocked) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalLocked) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLocked) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalLocked) Locked() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type MethodNotAllowed interface {
|
||||
ClientError
|
||||
MethodNotAllowed()
|
||||
}
|
||||
|
||||
type internalMethodNotAllowed struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func MethodNotAllowedWrap(err error) error {
|
||||
return internalMethodNotAllowed{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalMethodNotAllowed) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalMethodNotAllowed) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalMethodNotAllowed) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalMethodNotAllowed) MethodNotAllowed() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type NotAcceptable interface {
|
||||
ClientError
|
||||
NotAcceptable()
|
||||
}
|
||||
|
||||
type internalNotAcceptable struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NotAcceptableWrap(err error) error {
|
||||
return internalNotAcceptable{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalNotAcceptable) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalNotAcceptable) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotAcceptable) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotAcceptable) NotAcceptable() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type NotFound interface {
|
||||
ClientError
|
||||
NotFound ()
|
||||
}
|
||||
|
||||
type internalNotFound struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NotFoundWrap(err error) error {
|
||||
return internalNotFound {
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalNotFound ) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalNotFound ) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotFound ) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotFound ) NotFound() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type PaymentRequired interface {
|
||||
ClientError
|
||||
PaymentRequired()
|
||||
}
|
||||
|
||||
type internalPaymentRequired struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func PaymentRequiredWrap(err error) error {
|
||||
return internalPaymentRequired{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalPaymentRequired) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalPaymentRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPaymentRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPaymentRequired) PaymentRequired() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type PreconditionFailed interface {
|
||||
ClientError
|
||||
PreconditionFailed()
|
||||
}
|
||||
|
||||
type internalPreconditionFailed struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func PreconditionFailedWrap(err error) error {
|
||||
return internalPreconditionFailed{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalPreconditionFailed) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalPreconditionFailed) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPreconditionFailed) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPreconditionFailed) PreconditionFailed() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type PreconditionRequired interface {
|
||||
ClientError
|
||||
PreconditionRequired()
|
||||
}
|
||||
|
||||
type internalPreconditionRequired struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func PreconditionRequiredWrap(err error) error {
|
||||
return internalPreconditionRequired{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalPreconditionRequired) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalPreconditionRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPreconditionRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPreconditionRequired) PreconditionRequired() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type ProxyAuthRequired interface {
|
||||
ClientError
|
||||
ProxyAuthRequired()
|
||||
}
|
||||
|
||||
type internalProxyAuthRequired struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func ProxyAuthRequiredWrap(err error) error {
|
||||
return internalProxyAuthRequired{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalProxyAuthRequired) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalProxyAuthRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalProxyAuthRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalProxyAuthRequired) ProxyAuthRequired() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type RequestedRangeNotSatisfiable interface {
|
||||
ClientError
|
||||
RequestedRangeNotSatisfiable()
|
||||
}
|
||||
|
||||
type internalRequestedRangeNotSatisfiable struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func RequestedRangeNotSatisfiableWrap(err error) error {
|
||||
return internalRequestedRangeNotSatisfiable{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalRequestedRangeNotSatisfiable) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalRequestedRangeNotSatisfiable) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestedRangeNotSatisfiable) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestedRangeNotSatisfiable) RequestedRangeNotSatisfiable() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type RequestEntityTooLarge interface {
|
||||
ClientError
|
||||
RequestEntityTooLarge()
|
||||
}
|
||||
|
||||
type internalRequestEntityTooLarge struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func RequestEntityTooLargeWrap(err error) error {
|
||||
return internalRequestEntityTooLarge{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalRequestEntityTooLarge) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalRequestEntityTooLarge) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestEntityTooLarge) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestEntityTooLarge) RequestEntityTooLarge() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type RequestHeaderFieldsTooLarge interface {
|
||||
error
|
||||
Err() error
|
||||
RequestHeaderFieldsTooLarge()
|
||||
}
|
||||
|
||||
type internalRequestHeaderFieldsTooLarge struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func RequestHeaderFieldsTooLargeWrap(err error) error {
|
||||
return internalRequestHeaderFieldsTooLarge{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalRequestHeaderFieldsTooLarge) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalRequestHeaderFieldsTooLarge) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestHeaderFieldsTooLarge) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestHeaderFieldsTooLarge) RequestHeaderFieldsTooLarge() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
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) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestTimeout) RequestTimeout() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type RequestURITooLong interface {
|
||||
error
|
||||
Err() error
|
||||
RequestURITooLong()
|
||||
}
|
||||
|
||||
type internalRequestURITooLong struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func RequestURITooLongWrap(err error) error {
|
||||
return internalRequestURITooLong{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalRequestURITooLong) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalRequestURITooLong) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestURITooLong) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestURITooLong) RequestURITooLong() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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,6 @@
|
|||
package errhttp
|
||||
|
||||
type ServerError interface {
|
||||
Error
|
||||
ServerError()
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type Teapot interface {
|
||||
ClientError
|
||||
Teapot()
|
||||
}
|
||||
|
||||
type internalTeapot struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func TeapotWrap(err error) error {
|
||||
return internalTeapot{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalTeapot) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalTeapot) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalTeapot) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalTeapot) Teapot() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type TooManyRequests interface {
|
||||
ClientError
|
||||
TooManyRequests()
|
||||
}
|
||||
|
||||
type internalTooManyRequests struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func TooManyRequestsWrap(err error) error {
|
||||
return internalTooManyRequests{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalTooManyRequests) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalTooManyRequests) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalTooManyRequests) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalTooManyRequests) TooManyRequests() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type Unauthorized interface {
|
||||
ClientError
|
||||
Unauthorized()
|
||||
}
|
||||
|
||||
type internalUnauthorized struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func UnauthorizedWrap(err error) error {
|
||||
return internalUnauthorized{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalUnauthorized) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalUnauthorized) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnauthorized) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnauthorized) Unauthorized() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package errhttp
|
||||
|
||||
type UnavailableForLegalReasons interface {
|
||||
ClientError
|
||||
UnavailableForLegalReasons()
|
||||
}
|
||||
|
||||
type internalUnavailableForLegalReasons struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func UnavailableForLegalReasonsWrap(err error) error {
|
||||
return internalUnavailableForLegalReasons{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalUnavailableForLegalReasons) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalUnavailableForLegalReasons) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnavailableForLegalReasons) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnavailableForLegalReasons) UnavailableForLegalReasons() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type UnprocessableEntity interface {
|
||||
ClientError
|
||||
UnprocessableEntity()
|
||||
}
|
||||
|
||||
type internalUnprocessableEntity struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func UnprocessableEntityWrap(err error) error {
|
||||
return internalUnprocessableEntity{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalUnprocessableEntity) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalUnprocessableEntity) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnprocessableEntity) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnprocessableEntity) UnprocessableEntity() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type UnsupportedMediaType interface {
|
||||
ClientError
|
||||
UnsupportedMediaType()
|
||||
}
|
||||
|
||||
type internalUnsupportedMediaType struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func UnsupportedMediaTypeWrap(err error) error {
|
||||
return internalUnsupportedMediaType{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalUnsupportedMediaType) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalUnsupportedMediaType) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnsupportedMediaType) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnsupportedMediaType) UnsupportedMediaType() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
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) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUpgradeRequired) UpgradeRequired() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue