#ifndef __ROOF_ERROR_H #define __ROOF_ERROR_H #include #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, ...) do { \ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \ } while (0) #define roof_error(error, type, ...) do { \ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \ return; \ } while (0) #define roof_propagate_error(error, err, ...) do { \ g_propagate_prefixed_error(error, err, __VA_ARGS__); \ return; \ } while (0) #define roof_error_with_retval(error, retval, type, ...) do { \ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \ return retval; \ } while (0) #define roof_propagate_error_with_retval(error, retval, err, ...) do { \ g_propagate_prefixed_error(error, err, __VA_ARGS__); \ return retval; \ } while (0) #define roof_setup_error(error, ...) \ roof_error(error, SETUP, __VA_ARGS__) #define roof_setup_error_with_retval(error, ...) \ roof_error_with_retval(error, retval, SETUP, __VA_ARGS__) #define roof_new_error(error, ...) \ roof_error_with_retval(error, NULL, SETUP, __VA_ARGS__) #define roof_network_error(error, ...) \ roof_error(error, SETUP, __VA_ARGS__) #define root_set_network_error(error, ...) \ roof_set_error(error, SETUP, __VA_ARGS__) #define roof_network_error_with_retval(error, retval, ...) \ roof_error_with_retval(error, retval, SETUP, __VA_ARGS__) #define roof_memory_error(error, ...) \ roof_error(error, SETUP, __VA_ARGS__) #endif /* __ROOF_ERROR_H */