MCPcopy Create free account
hub / github.com/prometheus/prometheus / getDefaultErrorCode

Function getDefaultErrorCode

web/api/v1/api.go:2232–2251  ·  view source on GitHub ↗
(errType errorType)

Source from the content-addressed store, hash-verified

2230}
2231
2232func getDefaultErrorCode(errType errorType) int {
2233 switch errType {
2234 case errorBadData:
2235 return http.StatusBadRequest
2236 case errorExec:
2237 return http.StatusUnprocessableEntity
2238 case errorCanceled:
2239 return statusClientClosedConnection
2240 case errorTimeout:
2241 return http.StatusServiceUnavailable
2242 case errorInternal:
2243 return http.StatusInternalServerError
2244 case errorNotFound:
2245 return http.StatusNotFound
2246 case errorNotAcceptable:
2247 return http.StatusNotAcceptable
2248 default:
2249 return http.StatusInternalServerError
2250 }
2251}
2252
2253func parseTimeParam(r *http.Request, paramName string, defaultValue time.Time) (time.Time, error) {
2254 val := r.FormValue(paramName)

Callers 1

respondErrorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…