Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Response
- type Errors = NonEmpty Error
- data Error = Error Text [Location]
- class GraphQLError e where
- formatError :: e -> Text
- toError :: e -> Error
- singleError :: GraphQLError e => e -> Errors
Documentation
GraphQL response.
A GraphQL response must:
- be a map
- have a "data" key iff the operation executed
- have an "errors" key iff the operation encountered errors
- not include "data" if operation failed before execution (e.g. syntax errors, validation errors, missing info)
- not have keys other than "data", "errors", and "extensions"
Other interesting things:
- Doesn't have to be JSON, but does have to have maps, strings, lists, and null
- Can also support bool, int, enum, and float
- Value of "extensions" must be a map
"data" must be null if an error was encountered during execution that prevented a valid response.
"errors"
- must be a non-empty list
- each error is a map with "message", optionally "locations" key with list of locations
- locations are maps with 1-indexed "line" and "column" keys.
class GraphQLError e where Source #
An error that arises while processing a GraphQL query.
formatError :: e -> Text Source #
Represent an error as human-readable text, primarily intended for developers of GraphQL clients, and secondarily for developers of GraphQL servers.
toError :: e -> Error Source #
Represent an error as human-readable text, together with reference to a
series of locations within a GraphQL query document. Default
implementation calls formatError
and provides no locations.
Instances
GraphQLError NameError Source # | |
GraphQLError ValidationError Source # | |
Defined in GraphQL.Internal.Validation formatError :: ValidationError -> Text Source # toError :: ValidationError -> Error Source # | |
GraphQLError SchemaError Source # | |
Defined in GraphQL.Internal.API formatError :: SchemaError -> Text Source # toError :: SchemaError -> Error Source # | |
GraphQLError ResolverError Source # | |
Defined in GraphQL.Internal.Resolver formatError :: ResolverError -> Text Source # toError :: ResolverError -> Error Source # | |
GraphQLError ExecutionError Source # | |
Defined in GraphQL.Internal.Execution formatError :: ExecutionError -> Text Source # toError :: ExecutionError -> Error Source # | |
GraphQLError QueryError Source # | |
Defined in GraphQL formatError :: QueryError -> Text Source # toError :: QueryError -> Error Source # |
singleError :: GraphQLError e => e -> Errors Source #
Make a list of errors containing a single error.