public static function formatError(Error $exception)
    {
        $error = [
            'message' => $exception->getMessage(),
        ];

        $locations = $exception->getLocations();
        if (!empty($locations)) {
            $error['locations'] = array_map(function (SourceLocation $loc) {
                return $loc->toArray();
            }, $locations);
        }

        $previous = $exception->getPrevious();
        if ($previous && $previous instanceof ValidationException) {
            $error['validation'] = $previous->getResult()->getMessages();
        }

        return $error;
    }
public static function formatError(Error $exception)
    {
        $error = [
            'message' => $exception->getMessage(),
        ];

        $locations = $exception->getLocations();
        if (!empty($locations)) {
            $error['locations'] = array_map(function (SourceLocation $loc) {
                return $loc->toArray();
            }, $locations);
        }

        $previous = $exception->getPrevious();
        if ($previous && $previous instanceof ValidationException) {
            $error['validation'] = $previous->getResult()->getMessages();
        }

        return $error;
    }
public static function formatError ( Error $ exception ) { $ error = [ 'message' => $ exception -> getMessage ( ) , ] ; $ locations = $ exception -> getLocations ( ) ; if ( ! empty ( $ locations ) ) { $ error [ 'locations' ] = array_map ( function ( SourceLocation $ loc ) { return $ loc -> toArray ( ) ; } , $ locations ) ; } $ previous = $ exception -> getPrevious ( ) ; if ( $ previous && $ previous instanceof ValidationException ) { $ error [ 'validation' ] = $ previous -> getResult ( ) -> getMessages ( ) ; } return $ error ; }
More verbose error display defaults.

@param Error $exception
@return array
More verbose error display defaults .