summaryrefslogtreecommitdiffstats
path: root/error.c
Commit message (Collapse)AuthorAgeFilesLines
* error, qerror: drop QDict memberLuiz Capitulino2012-08-131-4/+0
| | | | | | | Used to store error information, but it's unused now. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* error, qerror: pass desc string to error callsLuiz Capitulino2012-08-131-2/+1
| | | | | | | | | | | | | | This commit changes all QERR_ macros to contain a human message (ie. the desc string found in qerr_table[]) instead of a json dictionary in string format. Before this commit, error_set() and qerror_report() would receive a json dictionary in string format and build a qobject from it. Now, both function receive a human message instead and the qobject is not built anymore. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* error: drop error_get_qobject()/error_set_qobject()Luiz Capitulino2012-08-131-20/+0
| | | | | | | | error_get_qobject() is unused since last commit, error_set_qobject() has never been used. Also drops error_int.h. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* error: drop unused functionsLuiz Capitulino2012-08-131-48/+0
| | | | | | | | Besides being unused, they operate on the current error format, which is going to be replaced soon. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* error: add error_get_class()Luiz Capitulino2012-08-131-0/+5
| | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* error, qerror: add ErrorClass argument to error functionsLuiz Capitulino2012-08-131-2/+6
| | | | | | | | | | | | | | | | The new argument is added to functions qerror_report() and error_set(). It's stored in Error and QError. qerror_report_err() is also updated to take care of it. The QERR_ macros are changed to contain a place holder value for the new argument, so that the value is used on all current calls to qerror_report() and error_set() (and also to initialize qerror_table[]). Next commit will update the QERR_ macros with a proper ErrorClass value. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* error: don't delay error message constructionLuiz Capitulino2012-08-131-7/+1
| | | | | | | | | | | Today, the error message is only constructed when it's used. This commit changes that to construct the error message when the error object is built (ie. when the error is reported). This simplifies the Error object. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* qerror: qerror_format(): return an allocated stringLuiz Capitulino2012-08-131-4/+1
| | | | | | | Simplifies current and future users. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* qapi: fix error propagationPaolo Bonzini2012-07-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | Don't overwrite / leak previously set errors. Make traversal cope with missing mandatory sub-structs. Don't try to end a container that could not be started. v1->v2: - unchanged v2->v3: - instead of examining, assert that we never overwrite errors with error_set() - allow visitors to set a NULL struct pointer successfully, so traversal of incomplete objects can continue - check for a NULL "obj" before accessing "(*obj)->has_XXX" (this is not a typo, "obj != NULL" implies "*obj != NULL" here) - fix start_struct / end_struct balance for unions as well Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* error.c: don't return value for void functionAmos Kong2012-04-201-1/+1
| | | | | | | | | | | | | It is invalid to return a value from a function returning void. [C99 6.8.6.4 says "A return statement with an expression shall not appear in a function whose return type is void" but gcc 4.6.3 with QEMU compile flags does not complain. It's still worth fixing this. Stefan] Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Error: Introduce error_copy()Luiz Capitulino2012-03-151-0/+13
| | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Drop qemu-objects.h from modules that don't require itLuiz Capitulino2011-10-271-1/+2
| | | | | | | | | | | Previous commits dropped most qobjects usage from qemu modules (now they are a low level interface used by the QAPI). However, some modules still include the qemu-objects.h header file. This commit drops qemu-objects.h from some of those modules and includes qjson.h instead, which is what they actually need. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* error: let error_is_type take a NULL errorAnthony Liguori2011-10-041-0/+4
| | | | | | Reported-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-5/+5
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* error framework: Fix compilation for w32/w64Stefan Weil2011-06-161-1/+2
| | | | | | | | | | | | | | | | | | | The declaration of function error_set() should use macro GCC_FMT_ATTR instead of gcc's format printf attribute. For w32/w64, both declarations are different and GCC_FMT_ATTR is needed. Compilation for w64 even failed with the original code because mingw64 defines a macro for printf. GCC_FMT_ATTR requires qemu-common.h, so add it in error.c (it's also included by error_int.h but too late). Remove assert.h which is included by qemu-common.h. Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Introduce the new error frameworkLuiz Capitulino2011-06-071-0/+140
New error-handling framework that allows for exception-like error propagation. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud