Flugg\Responder\Traits\HandlesApiErrors::renderApiError PHP Method

renderApiError() protected method

Renders any API exception into a JSON error response.
protected renderApiError ( ApiException $exception ) : Illuminate\Http\JsonResponse
$exception Flugg\Responder\Exceptions\Http\ApiException
return Illuminate\Http\JsonResponse
    protected function renderApiError(ApiException $exception) : JsonResponse
    {
        return app('responder.error')->setError($exception->getErrorCode(), $exception->getMessage())->addData($exception->getData() ?: [])->respond($exception->getStatusCode());
    }