pub struct Error {
pub message: String,
pub locations: Vec<ErrorLocation>,
pub path: Vec<String>,
}
Expand description
The response error type for GraphQL-over-HTTP server responses. As specified in the section 7.1.2 Errors and the Error Result Format subsection of the GraphQL specification.
Fields§
§message: String
A short, human-readable description of the problem.
From the Error Result Format subsection of the GraphQL specification:
Every error MUST contain an entry with the key
message
with a string description of the error intended for the developer as a guide to understand and correct the error.
locations: Vec<ErrorLocation>
A list of locations describing the beginning of the associated syntax element causing the error.
From the Error Result Format subsection of the GraphQL specification:
If an error can be associated to a particular point in the requested GraphQL document, it SHOULD contain an entry with the key
locations
with a list of locations, where each location is a map with the keysline
andcolumn
, both positive numbers starting from1
which describe the beginning of an associated syntax element.
path: Vec<String>
A list of path segments starting at the root of the response and ending with the field associated with the error.
From the Error Result Format subsection of the GraphQL specification:
If an error can be associated to a particular field in the GraphQL result, it must contain an entry with the key
path
that details the path of the response field which experienced the error. This allows clients to identify whether anull
result is intentional or caused by a runtime error.This field should be a list of path segments starting at the root of the response and ending with the field associated with the error. Path segments that represent fields should be strings, and path segments that represent list indices should be 0-indexed integers. If the error happens in an aliased field, the path to the error should use the aliased name, since it represents a path in the response, not in the request.