### Function Macro

# GLib assert_error

since: 2.20

#### Declaration

    #define g_assert_error (
      err,
      dom,
      c
    )

#### Description

Debugging macro to check that a method has returned the correct `GError`.

The effect of `g_assert_error (err, dom, c)` is the same as `g_assert_true (err != NULL && err->domain == dom && err->code == c)`. The advantage of this macro is that it can produce a message that includes the incorrect error message and code.

This can only be used to test for a specific error. If you want to test that `err` is set, but don’t care what it’s set to, just use `g_assert_nonnull (err)`.

Available since: 2.20

This function is not directly available to language bindings.

#### Parameters

`err`

  Type: `-`

  A `GError`, possibly `NULL`.

`dom`

  Type: `-`

  The expected error domain (a `GQuark`).

`c`

  Type: `-`

  The expected error code.