qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 01/17] error: introduce handle_error


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH v2 01/17] error: introduce handle_error
Date: Fri, 14 Dec 2012 14:00:45 -0200

On Thu, 13 Dec 2012 16:40:35 +0100
Pavel Hrdina <address@hidden> wrote:

> Signed-off-by: Pavel Hrdina <address@hidden>
> ---
>  error.c | 8 ++++++++
>  error.h | 6 ++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/error.c b/error.c
> index 128d88c..dd3ab66 100644
> --- a/error.c
> +++ b/error.c
> @@ -113,3 +113,11 @@ void error_propagate(Error **dst_err, Error *local_err)
>          error_free(local_err);
>      }
>  }
> +
> +void handle_error(Error **errp)
> +{
> +    if (error_is_set(errp)) {
> +        error_report("%s", error_get_pretty(*errp));
> +        error_free(*errp);
> +    }

This is not good for a few reasons. The most important ones are that
we most probably shouldn't be using error_report() in new qapi code. The
other reason is that this function doesn't actually handle the error.

I've added a similar function in hmp.c but just to save some typing,
but we shouldn't do this elsewhere.

> +}
> diff --git a/error.h b/error.h
> index 4d52e73..6a6acb5 100644
> --- a/error.h
> +++ b/error.h
> @@ -77,4 +77,10 @@ void error_propagate(Error **dst_err, Error *local_err);
>   */
>  void error_free(Error *err);
>  
> +/**
> + * Print an error object as pretty string to current monitor or on stderr, 
> then
> + * free the errot object.
> + */
> +void handle_error(Error **errp);
> +
>  #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]