diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2020-09-03 03:00:30 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2020-09-03 03:00:30 +0200 |
commit | 5172421d248250b4ab3b69eb57fd83656e23a4da (patch) | |
tree | a499d9f1dd0b74b754816884a59927b3171656fc /src/roof-error.h | |
parent | 7b2e6168b049be9e7852b2d364d897592eff69fc (diff) | |
download | ufo-roof-temp-master.tar.gz ufo-roof-temp-master.tar.bz2 ufo-roof-temp-master.tar.xz ufo-roof-temp-master.zip |
Diffstat (limited to 'src/roof-error.h')
-rw-r--r-- | src/roof-error.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/roof-error.h b/src/roof-error.h new file mode 100644 index 0000000..418645c --- /dev/null +++ b/src/roof-error.h @@ -0,0 +1,61 @@ +#ifndef __ROOF_ERROR_H +#define __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, ...) 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 */ |