|
Packit |
ae235b |
/* gerror.h - Error reporting system
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Copyright 2000 Red Hat, Inc.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is free software; you can redistribute it and/or
|
|
Packit |
ae235b |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
ae235b |
* License as published by the Free Software Foundation; either
|
|
Packit |
ae235b |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
ae235b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
ae235b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
ae235b |
* Lesser General Public License for more details.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
ae235b |
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#ifndef __G_ERROR_H__
|
|
Packit |
ae235b |
#define __G_ERROR_H__
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
|
Packit |
ae235b |
#error "Only <glib.h> can be included directly."
|
|
Packit |
ae235b |
#endif
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#include <stdarg.h>
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#include <glib/gquark.h>
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
G_BEGIN_DECLS
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GError:
|
|
Packit |
ae235b |
* @domain: error domain, e.g. #G_FILE_ERROR
|
|
Packit |
ae235b |
* @code: error code, e.g. %G_FILE_ERROR_NOENT
|
|
Packit |
ae235b |
* @message: human-readable informative error message
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The `GError` structure contains information about
|
|
Packit |
ae235b |
* an error that has occurred.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef struct _GError GError;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
struct _GError
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
GQuark domain;
|
|
Packit |
ae235b |
gint code;
|
|
Packit |
ae235b |
gchar *message;
|
|
Packit |
ae235b |
};
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GError* g_error_new (GQuark domain,
|
|
Packit |
ae235b |
gint code,
|
|
Packit |
ae235b |
const gchar *format,
|
|
Packit |
ae235b |
...) G_GNUC_PRINTF (3, 4);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GError* g_error_new_literal (GQuark domain,
|
|
Packit |
ae235b |
gint code,
|
|
Packit |
ae235b |
const gchar *message);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GError* g_error_new_valist (GQuark domain,
|
|
Packit |
ae235b |
gint code,
|
|
Packit |
ae235b |
const gchar *format,
|
|
Packit |
ae235b |
va_list args) G_GNUC_PRINTF(3, 0);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_error_free (GError *error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GError* g_error_copy (const GError *error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_error_matches (const GError *error,
|
|
Packit |
ae235b |
GQuark domain,
|
|
Packit |
ae235b |
gint code);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* if (err) *err = g_error_new(domain, code, format, ...), also has
|
|
Packit |
ae235b |
* some sanity checks.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_set_error (GError **err,
|
|
Packit |
ae235b |
GQuark domain,
|
|
Packit |
ae235b |
gint code,
|
|
Packit |
ae235b |
const gchar *format,
|
|
Packit |
ae235b |
...) G_GNUC_PRINTF (4, 5);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_set_error_literal (GError **err,
|
|
Packit |
ae235b |
GQuark domain,
|
|
Packit |
ae235b |
gint code,
|
|
Packit |
ae235b |
const gchar *message);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* if (dest) *dest = src; also has some sanity checks.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_propagate_error (GError **dest,
|
|
Packit |
ae235b |
GError *src);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* if (err && *err) { g_error_free(*err); *err = NULL; } */
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_clear_error (GError **err);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* if (err) prefix the formatted string to the ->message */
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_prefix_error (GError **err,
|
|
Packit |
ae235b |
const gchar *format,
|
|
Packit |
ae235b |
...) G_GNUC_PRINTF (2, 3);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* g_propagate_error then g_error_prefix on dest */
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_propagate_prefixed_error (GError **dest,
|
|
Packit |
ae235b |
GError *src,
|
|
Packit |
ae235b |
const gchar *format,
|
|
Packit |
ae235b |
...) G_GNUC_PRINTF (3, 4);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
G_END_DECLS
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#endif /* __G_ERROR_H__ */
|