From d9c1bf0df52144bd8e3303fa11c039e898c62358 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Tue, 29 Jul 2025 19:14:36 -0300 Subject: [PATCH] refactor(smallstrip,problems): make 500 error types distinct and not aliases --- problem/500.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/problem/500.go b/problem/500.go index 9c08bcd..c1e6e9c 100644 --- a/problem/500.go +++ b/problem/500.go @@ -136,10 +136,10 @@ func (p NotImplemented[T]) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func NewBadGateway(opts ...Option) BadGateway { - return NewStatus(http.StatusBadGateway, opts...) + return BadGateway(NewStatus(http.StatusBadGateway, opts...)) } -type BadGateway = Problem +type BadGateway Problem func NewServiceUnavailable[T time.Time | time.Duration](retryAfter T, opts ...Option) ServiceUnavailable[T] { p := NewStatus(http.StatusNotImplemented, opts...) @@ -217,43 +217,43 @@ func (p ServiceUnavailable[T]) ServeHTTP(w http.ResponseWriter, r *http.Request) } func NewGatewayTimeout(opts ...Option) GatewayTimeout { - return NewStatus(http.StatusGatewayTimeout, opts...) + return GatewayTimeout(NewStatus(http.StatusGatewayTimeout, opts...)) } -type GatewayTimeout = Problem +type GatewayTimeout Problem func NewHTTPVersionNotSupported(opts ...Option) HTTPVersionNotSupported { - return NewStatus(http.StatusHTTPVersionNotSupported, opts...) + return HTTPVersionNotSupported(NewStatus(http.StatusHTTPVersionNotSupported, opts...)) } -type HTTPVersionNotSupported = Problem +type HTTPVersionNotSupported Problem func NewVariantAlsoNegotiates(opts ...Option) VariantAlsoNegotiates { - return NewStatus(http.StatusVariantAlsoNegotiates, opts...) + return VariantAlsoNegotiates(NewStatus(http.StatusVariantAlsoNegotiates, opts...)) } -type VariantAlsoNegotiates = Problem +type VariantAlsoNegotiates Problem func NewInsufficientStorage(opts ...Option) InsufficientStorage { - return NewStatus(http.StatusInsufficientStorage, opts...) + return InsufficientStorage(NewStatus(http.StatusInsufficientStorage, opts...)) } -type InsufficientStorage = Problem +type InsufficientStorage Problem func NewLoopDetected(opts ...Option) LoopDetected { - return NewStatus(http.StatusLoopDetected, opts...) + return LoopDetected(NewStatus(http.StatusLoopDetected, opts...)) } -type LoopDetected = Problem +type LoopDetected Problem func NewNotExtended(opts ...Option) NotExtended { - return NewStatus(http.StatusNotExtended, opts...) + return NotExtended(NewStatus(http.StatusNotExtended, opts...)) } -type NotExtended = Problem +type NotExtended Problem func NewNetworkAuthenticationRequired(opts ...Option) NetworkAuthenticationRequired { - return NewStatus(http.StatusNetworkAuthenticationRequired, opts...) + return NetworkAuthenticationRequired(NewStatus(http.StatusNetworkAuthenticationRequired, opts...)) } -type NetworkAuthenticationRequired = Problem +type NetworkAuthenticationRequired Problem