qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] Fixing the error failure


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC] Fixing the error failure
Date: Tue, 26 Jun 2012 11:25:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 06/26/2012 06:21 AM, Markus Armbruster wrote:
"Daniel P. Berrange"<address@hidden>  writes:

On Tue, Jun 26, 2012 at 09:54:21AM +0200, Markus Armbruster wrote:
Luiz Capitulino<address@hidden>  writes:

On Thu, 21 Jun 2012 13:42:19 +0100
"Daniel P. Berrange"<address@hidden>  wrote:
[...]
In libvirt we have always reserved the right to change the error
code reported for particular scenarios. So, for example, alot of
our errors started out as "InternalError" (equiv to UndefinedError)
but over time we have changed some to more specialized values
eg "InvalidOperation", "ConfigNotSupported" and so on.

Do you reserve the right to make changes other than from InternalError
to a more specific one?

If I'm perfectly honest, then yes. We have tried not to gratuitouslyy
change errors being reported, but they have definitely evolved over
time, so more distinct error scenarios are reported, where previously
many things would have been lumped under one code.

Pragmatic co-evolution of errors with their actual use.  Makes sense to
me, and I'd recommend we do the same in QEMU.

Just to be clear, what we're discussing is:

diff --git a/qerror.c b/qerror.c
index 92c4eff..ebe2eb0 100644
--- a/qerror.c
+++ b/qerror.c
@@ -328,6 +328,10 @@ static const QErrorStringTable qerror_table[] = {
         .error_fmt = QERR_SOCKET_CREATE_FAILED,
         .desc      = "Failed to create socket",
     },
+    {
+        .error_fmt = QERR_UNDEFINED_ERROR,
+        .desc      = "Undefined Error: %(message)",
+    },
     {}
 };

diff --git a/qerror.h b/qerror.h
index b4c8758..da8f086 100644
--- a/qerror.h
+++ b/qerror.h
@@ -266,4 +266,7 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_SOCKET_CREATE_FAILED \
     "{ 'class': 'SockCreateFailed', 'data': {} }"

+#define QERR_UNDEFINED_ERROR \
+    "{ 'class': 'UndefinedError', 'data': { 'message': %s } }"
+
 #endif /* QERROR_H */

Nothing more, nothing less. No changes to wire protocol, no changes to existing error uses, etc.

Regards,

Anthony Liguori


[...]






reply via email to

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