"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.
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 */