Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Datasource string
Operation string
StatusCode int
Message string
ErrorSource string
}
APIError is a typed error for datasource query endpoints.
It preserves the datasource type, operation, HTTP status, and the human message extracted from Grafana or downstream datasource responses so the fail package can render a useful error instead of dumping raw JSON.
func FromBody ¶
FromBody constructs an APIError by extracting the most useful message from an HTTP response body. It understands Grafana's datasource query envelope as well as common {"error": ...} / {"message": ...} JSON responses.
The embedded `results.*.status` from the Grafana query envelope is only used as a fallback when the transport status is 2xx — i.e., to surface query-level failures hiding inside a 200 OK. When the transport status is already an error (4xx/5xx), it is kept as the authoritative signal so auth, proxy, and gateway failures are not misclassified by downstream-supplied status codes.
func (*APIError) IsParseError ¶
IsParseError reports whether the datasource returned a syntax/parse error.