### Method

# Gio DBusMethodInvocation return_error

since: 2.26

#### Declaration [src]

    void
    g_dbus_method_invocation_return_error (
      GDBusMethodInvocation* invocation,
      GQuark domain,
      gint code,
      const gchar* format,
      ...
    )

#### Description [src]

Finishes handling a D-Bus method call by returning an error.

See `g_dbus_error_encode_gerror()` for details about what error name will be returned on the wire. In a nutshell, if the given error is registered using `g_dbus_error_register_error()` the name given during registration is used. Otherwise, a name of the form `org.gtk.GDBus.UnmappedGError.Quark...` is used. This provides transparent mapping of `GError` between applications using GDBus.

If you are writing an application intended to be portable, always register errors with `g_dbus_error_register_error()` or use g_dbus_method_invocation_return_dbus_error().

This method will take ownership of `invocation`. See `GDBusInterfaceVTable` for more information about the ownership of `invocation`.

Since 2.48, if the method call requested for a reply not to be sent then this call will free `invocation` but otherwise do nothing (as per the recommendations of the D-Bus specification).

Available since: 2.26

This method is not directly available to language bindings.

#### Parameters

`invocation`

  Type: `GDBusMethodInvocation`

  A `GDBusMethodInvocation`.

  The instance takes ownership of the data, and is responsible for freeing it.

`domain`

  Type: `GQuark`

  A `GQuark` for the `GError` error domain.

`code`

  Type: `gint`

  The error code.

`format`

  Type: `const gchar*`

  Printf()-style format.

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

`...`

  Type: ``

  Parameters for `format`.