### Function

# GLib set_error

#### Declaration [src]

    void
    g_set_error (
      GError** err,
      GQuark domain,
      gint code,
      const gchar* format,
      ...
    )

#### Description [src]

Does nothing if `err` is `NULL`; if `err` is non-`NULL`, then `*err` must be `NULL`. A new `GError` is created and assigned to `*err`.

This function is not directly available to language bindings.

#### Parameters

`err`

  Type: `GError`

  A return location for a `GError`.

  The argument will be set by the function.
  The argument can be `NULL`.
  The caller of the function takes ownership of the returned data, and is responsible for freeing it.

`domain`

  Type: `GQuark`

  Error domain.

`code`

  Type: `gint`

  Error code.

`format`

  Type: `const gchar*`

  Printf()-style format.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  Args for `format`.