File indexing completed on 2025-02-22 10:38:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #pragma once
0022 #ifndef GFAL_COMMON_ERR_HELPERS_H_
0023 #define GFAL_COMMON_ERR_HELPERS_H_
0024
0025 #include "gfal_common.h"
0026 #include <errno.h>
0027
0028 #if !defined(__GFAL2_H_INSIDE__) && !defined(__GFAL2_BUILD__)
0029 # warning "Direct inclusion of gfal2 headers is deprecated. Please, include only gfal_api.h or gfal_plugins_api.h"
0030 #endif
0031
0032 #ifdef __cplusplus
0033 extern "C" {
0034 #endif
0035
0036
0037
0038
0039
0040 void gfal2_set_error(GError **err,
0041 GQuark domain,
0042 gint code,
0043 const gchar *function,
0044 const gchar *format,
0045 ...) G_GNUC_PRINTF (5, 6);
0046
0047
0048
0049
0050
0051 void gfal2_propagate_prefixed_error_extended(GError **dest,
0052 GError *src,
0053 const gchar *function,
0054 const gchar *format,
0055 ...) G_GNUC_PRINTF (4, 5);
0056
0057
0058
0059
0060 void gfal2_propagate_prefixed_error(GError **dest,
0061 GError *src,
0062 const gchar *function);
0063
0064
0065 #ifdef __cplusplus
0066 }
0067 #endif
0068
0069
0070
0071
0072 #define g_return_val_err_if_fail(exp, val, err, msg) if(!(exp)){ g_set_error(err, gfal2_get_core_quark(), EINVAL, msg); return val; }
0073
0074
0075
0076 #define G_RETURN_ERR(ret, tmp_err, err) \
0077 if(tmp_err)\
0078 gfal2_propagate_prefixed_error(err, tmp_err, __func__);\
0079 return ret
0080
0081 #endif