server error
parent
4bd4e6ca41
commit
1b349fbb21
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type BadGateway interface {
|
||||
ServerError
|
||||
BadGateway()
|
||||
}
|
||||
|
||||
type internalBadGateway struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func BadGatewayWrap(err error) error {
|
||||
return internalBadGateway{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalBadGateway) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalBadGateway) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalBadGateway) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalBadGateway) BadGateway() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type GatewayTimeout interface {
|
||||
ServerError
|
||||
GatewayTimeout()
|
||||
}
|
||||
|
||||
type internalGatewayTimeout struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func GatewayTimeoutWrap(err error) error {
|
||||
return internalGatewayTimeout{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalGatewayTimeout) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalGatewayTimeout) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalGatewayTimeout) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalGatewayTimeout) GatewayTimeout() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type HTTPVersionNotSupported interface {
|
||||
ServerError
|
||||
HTTPVersionNotSupported()
|
||||
}
|
||||
|
||||
type internalHTTPVersionNotSupported struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func HTTPVersionNotSupportedWrap(err error) error {
|
||||
return internalHTTPVersionNotSupported{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalHTTPVersionNotSupported) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalHTTPVersionNotSupported) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalHTTPVersionNotSupported) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalHTTPVersionNotSupported) HTTPVersionNotSupported() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type InsufficientStorage interface {
|
||||
ServerError
|
||||
InsufficientStorage()
|
||||
}
|
||||
|
||||
type internalInsufficientStorage struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func InsufficientStorageWrap(err error) error {
|
||||
return internalInsufficientStorage{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalInsufficientStorage) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalInsufficientStorage) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalInsufficientStorage) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalInsufficientStorage) InsufficientStorage() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type InternalServerError interface {
|
||||
ServerError
|
||||
InternalServerError()
|
||||
}
|
||||
|
||||
type internalInternalServerError struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func InternalServerErrorWrap(err error) error {
|
||||
return internalInternalServerError{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalInternalServerError) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalInternalServerError) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalInternalServerError) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalInternalServerError) InternalServerError() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type LoopDetected interface {
|
||||
ServerError
|
||||
LoopDetected()
|
||||
}
|
||||
|
||||
type internalLoopDetected struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func LoopDetectedWrap(err error) error {
|
||||
return internalLoopDetected{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalLoopDetected) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalLoopDetected) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLoopDetected) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalLoopDetected) LoopDetected() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type NetworkAuthenticationRequired interface {
|
||||
ServerError
|
||||
NetworkAuthenticationRequired()
|
||||
}
|
||||
|
||||
type internalNetworkAuthenticationRequired struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NetworkAuthenticationRequiredWrap(err error) error {
|
||||
return internalNetworkAuthenticationRequired{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalNetworkAuthenticationRequired) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalNetworkAuthenticationRequired) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNetworkAuthenticationRequired) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNetworkAuthenticationRequired) NetworkAuthenticationRequired() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type NotExtended interface {
|
||||
ServerError
|
||||
NotExtended()
|
||||
}
|
||||
|
||||
type internalNotExtended struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NotExtendedWrap(err error) error {
|
||||
return internalNotExtended{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalNotExtended) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalNotExtended) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotExtended) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotExtended) NotExtended() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type NotImplemented interface {
|
||||
ServerError
|
||||
NotImplemented()
|
||||
}
|
||||
|
||||
type internalNotImplemented struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NotImplementedWrap(err error) error {
|
||||
return internalNotImplemented{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalNotImplemented) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalNotImplemented) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotImplemented) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotImplemented) NotImplemented() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -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.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type ServiceUnavailable interface {
|
||||
ServerError
|
||||
ServiceUnavailable()
|
||||
}
|
||||
|
||||
type internalServiceUnavailable struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func ServiceUnavailableWrap(err error) error {
|
||||
return internalServiceUnavailable{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalServiceUnavailable) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalServiceUnavailable) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalServiceUnavailable) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalServiceUnavailable) ServiceUnavailable() {
|
||||
// Nothing here.
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package errhttp
|
||||
|
||||
type VariantAlsoNegotiates interface {
|
||||
ServerError
|
||||
VariantAlsoNegotiates()
|
||||
}
|
||||
|
||||
type internalVariantAlsoNegotiates struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func VariantAlsoNegotiatesWrap(err error) error {
|
||||
return internalVariantAlsoNegotiates{
|
||||
err:err,
|
||||
}
|
||||
}
|
||||
|
||||
func (receiver internalVariantAlsoNegotiates) Error() string {
|
||||
return receiver.err.Error()
|
||||
}
|
||||
|
||||
func (receiver internalVariantAlsoNegotiates) Err() error {
|
||||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalVariantAlsoNegotiates) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalVariantAlsoNegotiates) VariantAlsoNegotiates() {
|
||||
// Nothing here.
|
||||
}
|
Loading…
Reference in New Issue