File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package fantasy
33import (
44 "fmt"
55 "net/http"
6+ "strings"
67
78 "github.com/charmbracelet/x/exp/slice"
89)
@@ -69,19 +70,7 @@ func (e RetryError) Unwrap() error {
6970 return nil
7071}
7172
72- var statusCodeToTitle = map [int ]string {
73- http .StatusBadRequest : "bad request" ,
74- http .StatusUnauthorized : "authentication failed" ,
75- http .StatusForbidden : "permission denied" ,
76- http .StatusNotFound : "resource not found" ,
77- http .StatusTooManyRequests : "rate limit exceeded" ,
78- http .StatusInternalServerError : "internal server error" ,
79- http .StatusBadGateway : "bad gateway" ,
80- http .StatusServiceUnavailable : "service unavailable" ,
81- http .StatusGatewayTimeout : "gateway timeout" ,
82- }
83-
8473// ErrorTitleForStatusCode returns a human-readable title for a given HTTP status code.
8574func ErrorTitleForStatusCode (statusCode int ) string {
86- return statusCodeToTitle [ statusCode ]
75+ return strings . ToLower ( http . StatusText ( statusCode ))
8776}
You can’t perform that action at this time.
0 commit comments