src/Base/ExceptionHandler.php
private function getResponse($code = 500, $headers = [], $body = null)
    {
        if (isset($body) && is_array($body)) {
            if (!isset($body['error'])) {
                $body = ['error' => $body];
            }
            $body = json_encode($body);
            $headers['Content-type'] = 'application/json';
        }
        return new Response($code, $headers, $body);
    }
private function getResponse($code = 500, $headers = [], $body = null)
    {
        if (isset($body) && is_array($body)) {
            if (!isset($body['error'])) {
                $body = ['error' => $body];
            }
            $body = json_encode($body);
            $headers['Content-type'] = 'application/json';
        }
        return new Response($code, $headers, $body);
    }
Get error response
@param int    $code
@param string $body
@param array  $headers
@return Response