Classes/View/GraphQlView.php
private function formatResult(ExecutionResult $executionResult)
    {
        $convertedResult = [
            'data' => $executionResult->data,
        ];
        if (!empty($executionResult->errors)) {
            $convertedResult['errors'] = array_map(function(Error $error) {
                $errorResult = [
                    'message' => $error->message,
                    'locations' => $error->getLocations()
                ];
                $exception = $error->getPrevious();
                if ($exception instanceof FlowException) {
                    $errorResult['message'] = HttpResponse::getStatusMessageByCode($exception->getStatusCode());
                    $errorResult['_exceptionCode'] = $exception->getCode();
                    $errorResult['_statusCode'] = $exception->getStatusCode();
                    $errorResult['_referenceCode'] = $exception->getReferenceCode();
                }
                if ($exception instanceof \Exception) {
                    $this->systemLogger->logException($exception);
                }
                return $errorResult;
            }, $executionResult->errors);
        }
        if (!empty($executionResult->extensions)) {
            $convertedResult['extensions'] = (array)$executionResult->extensions;
        }
        return $convertedResult;
    }
private function formatResult(ExecutionResult $executionResult)
    {
        $convertedResult = [
            'data' => $executionResult->data,
        ];
        if (!empty($executionResult->errors)) {
            $convertedResult['errors'] = array_map(function(Error $error) {
                $errorResult = [
                    'message' => $error->message,
                    'locations' => $error->getLocations()
                ];
                $exception = $error->getPrevious();
                if ($exception instanceof FlowException) {
                    $errorResult['message'] = HttpResponse::getStatusMessageByCode($exception->getStatusCode());
                    $errorResult['_exceptionCode'] = $exception->getCode();
                    $errorResult['_statusCode'] = $exception->getStatusCode();
                    $errorResult['_referenceCode'] = $exception->getReferenceCode();
                }
                if ($exception instanceof \Exception) {
                    $this->systemLogger->logException($exception);
                }
                return $errorResult;
            }, $executionResult->errors);
        }
        if (!empty($executionResult->extensions)) {
            $convertedResult['extensions'] = (array)$executionResult->extensions;
        }
        return $convertedResult;
    }
private function formatResult ( ExecutionResult $ executionResult ) { $ convertedResult = [ 'data' => $ executionResult -> data , ] ; if ( ! empty ( $ executionResult -> errors ) ) { $ convertedResult [ 'errors' ] = array_map ( function ( Error $ error ) { $ errorResult = [ 'message' => $ error -> message , 'locations' => $ error -> getLocations ( ) ] ; $ exception = $ error -> getPrevious ( ) ; if ( $ exception instanceof FlowException ) { $ errorResult [ 'message' ] = HttpResponse :: getStatusMessageByCode ( $ exception -> getStatusCode ( ) ) ; $ errorResult [ '_exceptionCode' ] = $ exception -> getCode ( ) ; $ errorResult [ '_statusCode' ] = $ exception -> getStatusCode ( ) ; $ errorResult [ '_referenceCode' ] = $ exception -> getReferenceCode ( ) ; } if ( $ exception instanceof \ Exception ) { $ this -> systemLogger -> logException ( $ exception ) ; } return $ errorResult ; } , $ executionResult -> errors ) ; } if ( ! empty ( $ executionResult -> extensions ) ) { $ convertedResult [ 'extensions' ] = ( array ) $ executionResult -> extensions ; } return $ convertedResult ; }
Formats the result of the GraphQL execution, converting Flow exceptions by hiding the original exception message
and adding status- and referenceCode.

@param ExecutionResult $executionResult
@return array
Formats the result of the GraphQL execution converting Flow exceptions by hiding the original exception message and adding status - and referenceCode .