docs(smalltrip,exceptions): document all 500s status code constructors
This commit is contained in:
@@ -5,6 +5,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// InternalServerError creates a new [Exception] with the "500 Internal Server Error"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
|
//
|
||||||
|
// An error should be provided to add context to the exception.
|
||||||
func InternalServerError(err error, opts ...Option) Exception {
|
func InternalServerError(err error, opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusInternalServerError),
|
WithStatus(http.StatusInternalServerError),
|
||||||
@@ -18,6 +23,9 @@ func InternalServerError(err error, opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotImplemented creates a new [Exception] with the "501 Not Implemented"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func NotImplemented(opts ...Option) Exception {
|
func NotImplemented(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusNotImplemented),
|
WithStatus(http.StatusNotImplemented),
|
||||||
@@ -31,6 +39,9 @@ func NotImplemented(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BadGateway creates a new [Exception] with the "502 Bad Gateway"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func BadGateway(opts ...Option) Exception {
|
func BadGateway(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusBadGateway),
|
WithStatus(http.StatusBadGateway),
|
||||||
@@ -44,6 +55,9 @@ func BadGateway(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ServiceUnavailable creates a new [Exception] with the "503 Service Unavailable"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func ServiceUnavailable(opts ...Option) Exception {
|
func ServiceUnavailable(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusServiceUnavailable),
|
WithStatus(http.StatusServiceUnavailable),
|
||||||
@@ -57,6 +71,9 @@ func ServiceUnavailable(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GatewayTimeout creates a new [Exception] with the "504 Gateway Timeout"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func GatewayTimeout(opts ...Option) Exception {
|
func GatewayTimeout(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusGatewayTimeout),
|
WithStatus(http.StatusGatewayTimeout),
|
||||||
@@ -70,6 +87,9 @@ func GatewayTimeout(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPVersionNotSupported creates a new [Exception] with the "505 HTTP Version Not Supported"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func HTTPVersionNotSupported(opts ...Option) Exception {
|
func HTTPVersionNotSupported(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusHTTPVersionNotSupported),
|
WithStatus(http.StatusHTTPVersionNotSupported),
|
||||||
@@ -83,6 +103,9 @@ func HTTPVersionNotSupported(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VariantAlsoNegotiates creates a new [Exception] with the "506 Variant Also Negotiates"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func VariantAlsoNegotiates(opts ...Option) Exception {
|
func VariantAlsoNegotiates(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusVariantAlsoNegotiates),
|
WithStatus(http.StatusVariantAlsoNegotiates),
|
||||||
@@ -96,6 +119,9 @@ func VariantAlsoNegotiates(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InsufficientStorage creates a new [Exception] with the "507 Insufficient Storage"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func InsufficientStorage(opts ...Option) Exception {
|
func InsufficientStorage(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusInsufficientStorage),
|
WithStatus(http.StatusInsufficientStorage),
|
||||||
@@ -109,6 +135,9 @@ func InsufficientStorage(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoopDetected creates a new [Exception] with the "508 Loop Detected"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func LoopDetected(opts ...Option) Exception {
|
func LoopDetected(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusLoopDetected),
|
WithStatus(http.StatusLoopDetected),
|
||||||
@@ -122,6 +151,9 @@ func LoopDetected(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotExtended creates a new [Exception] with the "510 Not Extended"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func NotExtended(opts ...Option) Exception {
|
func NotExtended(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusLoopDetected),
|
WithStatus(http.StatusLoopDetected),
|
||||||
@@ -135,6 +167,9 @@ func NotExtended(opts ...Option) Exception {
|
|||||||
return newException(o...)
|
return newException(o...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkAuthenticationRequired creates a new [Exception] with the "511 Network Authentication Required"
|
||||||
|
// status code, a human readable message and the provided error describing what in
|
||||||
|
// the request was wrong. The severity of this Exception by default is [ERROR].
|
||||||
func NetworkAuthenticationRequired(opts ...Option) Exception {
|
func NetworkAuthenticationRequired(opts ...Option) Exception {
|
||||||
o := []Option{
|
o := []Option{
|
||||||
WithStatus(http.StatusNetworkAuthenticationRequired),
|
WithStatus(http.StatusNetworkAuthenticationRequired),
|
||||||
|
|||||||
Reference in New Issue
Block a user