diff options
Diffstat (limited to 'src/ufo-roof-error.h')
-rw-r--r-- | src/ufo-roof-error.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/ufo-roof-error.h b/src/ufo-roof-error.h new file mode 100644 index 0000000..ed0ae2b --- /dev/null +++ b/src/ufo-roof-error.h @@ -0,0 +1,58 @@ +#ifndef __UFO_ROOF_ERROR_H +#define __UFO_ROOF_ERROR_H + +#include <ufo/ufo.h> + + +#define roof_print_error(error) do { \ + g_warning("%s", error->message); \ + g_error_free(error); \ + error = NULL; \ + } while (0) + +#define roof_set_error(error, type, msg...) do { \ + if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \ + } while (0) + +#define roof_error(error, type, msg...) do { \ + if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \ + return; \ + } while (0) + +#define roof_propagate_error(error, err, msg...) do { \ + g_propagate_prefixed_error(error, err, msg); \ + return; \ + } while (0) + +#define roof_error_with_retval(error, retval, type, msg...) do { \ + if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \ + return retval; \ + } while (0) + +#define roof_propagate_error_with_retval(error, retval, err, msg...) do { \ + g_propagate_prefixed_error(error, err, msg); \ + return retval; \ + } while (0) + + +#define roof_setup_error(error, msg...) \ + roof_error(error, SETUP, msg) + +#define roof_new_error(error, msg...) \ + roof_error_with_retval(error, NULL, SETUP, msg) + + +#define roof_network_error(error, msg...) \ + roof_error(error, SETUP, msg) + +#define root_set_network_error(error, msg...) \ + roof_set_error(error, SETUP, msg) + +#define roof_network_error_with_retval(error, retval, msg...) \ + roof_error_with_retval(error, retval, SETUP, msg) + +#define roof_memory_error(error, msg...) \ + roof_error(error, SETUP, msg) + + +#endif /* __UFO_ROOF_ERROR_H */ |