[Please, read below why this is an RFC] This series implements the 'Plan for error handling in QMP' as described by Anthony in this email:
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg03764.html Basically, this replaces almost all error classes by GenericError (the exception are a few error classes used by libvirt) and drops the error data memeber. This also adds a free form string to error_set(). On the wire, we go from: { "error": { "class": "DeviceNotRemovable", "data": { "device": "virtio0" }, "desc": "Device 'virtio0' is not removable" } } to: { "error": { "class": "GenericError", "desc": "Device 'virtio0' is not removable" } } Internally, we go from: void error_set(Error **err, const char *fmt, ...); to: void error_set(Error **err, ErrorClass err_class, const char *fmt, ...); This series is in RFC state because when I was almost done I've found that I've broke error_is_type() and qemu-ga (both should be easy to fix). Besides, the resulting code is missing some simplifications and more testing... But I wanted to drop this before going out for the weekend :) QMP/qmp-spec.txt | 10 +- block.c | 1 + block_int.h | 1 + configure | 10 - error.c | 46 +---- error.h | 15 +- error_int.h | 1 - hmp.c | 80 +++++--- hmp.h | 1 + monitor.c | 80 ++------ qapi-schema.json | 33 +++- qerror.c | 514 ++------------------------------------------------ qerror.h | 164 ++++++++-------- qmp-commands.hx | 3 +- scripts/qapi-types.py | 17 +- scripts/qapi.py | 4 +- 16 files changed, 226 insertions(+), 754 deletions(-)