prepareErrorResponse prepares an error response in the appropriate format. The action handler
should return an ErrorResponse response when the action is not successful. If useBody is true,
the response will be returned as an object with the HTTP response code and the ErrorResponse in
the body field. If useBody is false, the ErrorResponse will be returned directly.
prepareErrorResponse prepares an error response in the appropriate format. The action handler should return an ErrorResponse response when the action is not successful. If useBody is true, the response will be returned as an object with the HTTP response code and the ErrorResponse in the body field. If useBody is false, the ErrorResponse will be returned directly.