PHP Class GraphQL\Error\Error

Inheritance: extends Exception, implements JsonSerializable
Show file Open project: webonyx/graphql-php Class Usage Examples

Public Properties

Property Type Description
$message string A message describing the Error for debugging purposes.
$nodes array An array of GraphQL AST Nodes corresponding to this error.
$path array An array describing the JSON-path into the execution response which corresponds to this error. Only included for errors during execution.

Public Methods

Method Description
__construct ( string $message, array | null $nodes = null, Source $source = null, array | null $positions = null, array | null $path = null, Exception $previous = null )
createLocatedError ( $error, array | null $nodes = null, array | null $path = null ) : Error Given an arbitrary Error, presumably thrown while attempting to execute a GraphQL operation, produce a new GraphQLError aware of the location in the document responsible for the original Error.
formatError ( Error $error ) : array
getLocations ( ) : SourceLocation[]
getPositions ( ) : array
getSource ( ) : Source | null
jsonSerialize ( ) : mixed Specify data which should be serialized to JSON
toSerializableArray ( ) : array Returns array representation of error suitable for serialization

Method Details

__construct() public method

public __construct ( string $message, array | null $nodes = null, Source $source = null, array | null $positions = null, array | null $path = null, Exception $previous = null )
$message string
$nodes array | null
$source GraphQL\Language\Source
$positions array | null
$path array | null
$previous Exception

createLocatedError() public static method

Given an arbitrary Error, presumably thrown while attempting to execute a GraphQL operation, produce a new GraphQLError aware of the location in the document responsible for the original Error.
public static createLocatedError ( $error, array | null $nodes = null, array | null $path = null ) : Error
$error
$nodes array | null
$path array | null
return Error

formatError() public static method

public static formatError ( Error $error ) : array
$error Error
return array

getLocations() public method

public getLocations ( ) : SourceLocation[]
return GraphQL\Language\SourceLocation[]

getPositions() public method

public getPositions ( ) : array
return array

getSource() public method

public getSource ( ) : Source | null
return GraphQL\Language\Source | null

jsonSerialize() public method

Specify data which should be serialized to JSON
public jsonSerialize ( ) : mixed
return mixed data which can be serialized by json_encode, which is a value of any type other than a resource.

toSerializableArray() public method

Returns array representation of error suitable for serialization
public toSerializableArray ( ) : array
return array

Property Details

$message public property

A message describing the Error for debugging purposes.
public string $message
return string

$nodes public property

An array of GraphQL AST Nodes corresponding to this error.
public array $nodes
return array

$path public property

An array describing the JSON-path into the execution response which corresponds to this error. Only included for errors during execution.
public array $path
return array