Struct

GLibError

Description

struct GError {
  GQuark domain;
  gint code;
  gchar* message;
}

The GError structure contains information about an error that has occurred.

Structure members
domain

Error domain, e.g. G_FILE_ERROR.

code

Error code, e.g. G_FILE_ERROR_NOENT.

message

Human-readable informative error message.

Constructors

g_error_new

Creates a new GError with the given domain and code, and a message formatted with format.

g_error_new_literal

Creates a new GError; unlike g_error_new(), message is not a printf()-style format string. Use this function if message contains text you don’t have control over, that could include printf() escape sequences.

g_error_new_valist

Creates a new GError with the given domain and code, and a message formatted with format.

since: 2.22

Functions

g_error_domain_register

This function registers an extended GError domain. error_type_name will be duplicated. Otherwise does the same as g_error_domain_register_static().

since: 2.68

g_error_domain_register_static

This function registers an extended GError domain.

since: 2.68

Instance methods

g_error_copy

Makes a copy of error.

g_error_free

Frees a GError and associated resources.

g_error_matches

Returns TRUE if error matches domain and code, FALSE otherwise. In particular, when error is NULL, FALSE will be returned.