Controller/AbstractRestController.php
public function renderError(
        $request,
        $message,
        $statusCode = Response::HTTP_BAD_REQUEST
    ) {
        $response = [
            'errors' => [],
            'message' => $message,
            'code' => $statusCode
        ];

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

        return $this->renderRest($request, $response, $statusCode);
    }
Error Response

@param Request $request
@param string  $message
@param int     $statusCode

@return Response