On a Thursday in 2020, Martin Kletzander wrote:
On Thu, Sep 10, 2020 at 01:56:53PM +0200, Pino Toscano wrote:
>A lot of virReportError() calls use VIR_ERR_INTERNAL_ERROR to represent
>the number of the error, even in cases where there is one fitting more.
>Hence, replace some of them with better virErrorNumber values.
>
This is something that we need to do in oh-so-many places, yes.
I just pin-pointed few things, feel free to correct me though.
>Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
>---
>src/esx/esx_network_driver.c | 4 ++--
>src/esx/esx_storage_backend_iscsi.c | 4 ++--
>src/esx/esx_storage_backend_vmfs.c | 12 +++++-----
>src/esx/esx_util.c | 4 ++--
>src/esx/esx_vi.c | 36 ++++++++++++++---------------
>5 files changed, 30 insertions(+), 30 deletions(-)
>
>@@ -839,7 +839,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
>
> if (!ctx || !url || !ipAddress || !username ||
> !password || ctx->url || ctx->service || ctx->curl) {
>- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
>+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid
argument"));
These actually change the error message from:
error: internal error: Invalid argument
to:
error: invalid argument: Invalid argument
You can do:
virReportError(VIR_ERR_INVALID_ARG, NULL);
to get rid of the duplicit message.
Jano
not sure it helps anything. Internal error would at least show that
this is
something the user could not affect directly by their usage, but rather the
issue comes from below (and we have no way of fixing it or are not handling
something well ourselves).
> return -1;
> }
>