private function createErrorResponse($code, $message = null, array $data = [])
    {
        if (!$message) {
            $messages = $this->handler->getErrors()->getErrors();
            $message = isset($messages[$code]) ? $messages[$code] : 'Error';
        }

        $json = [
            'jsonrpc' => self::JSON_RPC_VERSION,
            'error' => [
                'code' => $code,
                'message' => $message
            ],
            'id' => $this->requestId
        ];

        if ($data) {
            $json['error']['data'] = $data;
        }

        return new JsonResponse($json, 200);
    }
private function createErrorResponse($code, $message = null, array $data = [])
    {
        if (!$message) {
            $messages = $this->handler->getErrors()->getErrors();
            $message = isset($messages[$code]) ? $messages[$code] : 'Error';
        }

        $json = [
            'jsonrpc' => self::JSON_RPC_VERSION,
            'error' => [
                'code' => $code,
                'message' => $message
            ],
            'id' => $this->requestId
        ];

        if ($data) {
            $json['error']['data'] = $data;
        }

        return new JsonResponse($json, 200);
    }
private function createErrorResponse ( $ code , $ message = null , array $ data = [ ] ) { if ( ! $ message ) { $ messages = $ this -> handler -> getErrors ( ) -> getErrors ( ) ; $ message = isset ( $ messages [ $ code ] ) ? $ messages [ $ code ] : 'Error' ; } $ json = [ 'jsonrpc' => self :: JSON_RPC_VERSION , 'error' => [ 'code' => $ code , 'message' => $ message ] , 'id' => $ this -> requestId ] ; if ( $ data ) { $ json [ 'error' ] [ 'data' ] = $ data ; } return new JsonResponse ( $ json , 200 ) ; }
Create error response

@param integer $code
@param string  $message
@param array   $data

@return JsonResponse
Create error response