code: public function renderError(
          $request,
          $message,
          $statusCode = Response::HTTP_BAD_REQUEST
      ) {
          $response = [
              'errors' => [],
              'message' => $message,
              'code' => $statusCode
          ];
  
          return $this->renderRest($request, $response, $statusCode);
      }
docs: Error Response
  
  @param Request $request
  @param string  $message
  @param int     $statusCode
  
  @return Response