1 /* gerror.h - Error reporting system
3 * Copyright 2000 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, see <http://www.gnu.org/licenses/>.
22 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
23 #error "Only <glib.h> can be included directly."
28 #include <glib/gquark.h>
34 * @domain: error domain, e.g. #G_FILE_ERROR
35 * @code: error code, e.g. %G_FILE_ERROR_NOENT
36 * @message: human-readable informative error message
38 * The `GError` structure contains information about
39 * an error that has occurred.
41 typedef struct _GError GError
;
51 GError
* g_error_new (GQuark domain
,
54 ...) G_GNUC_PRINTF (3, 4);
57 GError
* g_error_new_literal (GQuark domain
,
59 const gchar
*message
);
61 GError
* g_error_new_valist (GQuark domain
,
64 va_list args
) G_GNUC_PRINTF(3, 0);
67 void g_error_free (GError
*error
);
69 GError
* g_error_copy (const GError
*error
);
72 gboolean
g_error_matches (const GError
*error
,
76 /* if (err) *err = g_error_new(domain, code, format, ...), also has
80 void g_set_error (GError
**err
,
84 ...) G_GNUC_PRINTF (4, 5);
87 void g_set_error_literal (GError
**err
,
90 const gchar
*message
);
92 /* if (dest) *dest = src; also has some sanity checks.
95 void g_propagate_error (GError
**dest
,
98 /* if (err && *err) { g_error_free(*err); *err = NULL; } */
100 void g_clear_error (GError
**err
);
102 /* if (err) prefix the formatted string to the ->message */
103 GLIB_AVAILABLE_IN_ALL
104 void g_prefix_error (GError
**err
,
106 ...) G_GNUC_PRINTF (2, 3);
108 /* g_propagate_error then g_error_prefix on dest */
109 GLIB_AVAILABLE_IN_ALL
110 void g_propagate_prefixed_error (GError
**dest
,
113 ...) G_GNUC_PRINTF (3, 4);
117 #endif /* __G_ERROR_H__ */