ErrorBuilder

Builder for constructing GraphQLError instances.

Typically used inside a ResolverErrorBuilder implementation to build custom error responses. When created via newError(metadata), the path and location are automatically populated from the ErrorReporter.Metadata.

See also

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Builds and returns the GraphQLError.

Link copied to clipboard
fun extension(key: String, value: Any?): ErrorBuilder

Adds a single key-value pair to this error's extensions map.

Link copied to clipboard
fun extensions(extensions: Map<String, Any?>): ErrorBuilder

Merges the given entries into this error's extensions map.

Link copied to clipboard
fun location(location: SourceLocation): ErrorBuilder

Sets a single source location for this error.

Link copied to clipboard
fun locations(locations: List<SourceLocation>): ErrorBuilder

Sets multiple source locations for this error.

Link copied to clipboard
fun message(message: String): ErrorBuilder

Sets the human-readable error message.

Link copied to clipboard
fun path(path: List<Any>): ErrorBuilder

Sets the execution path to the field that produced this error.