Gio.Task.prototype.return_error

function return_error(error: GLib.Error): void {
    // Gjs wrapper for g_task_return_error()
}
  

Sets task's result to error (which task assumes ownership of) and completes the task (see Gio.Task.prototype.return_pointer for more discussion of exactly what this means).

Note that since the task takes ownership of error, and since the task may be completed before returning from Gio.Task.prototype.return_error, you cannot assume that error is still valid after calling this. Call GLib.Error.prototype.copy on the error if you need to keep a local copy as well.

See also Gio.Task.return_new_error.

Since 2.36

error

the GLib.Error result of a task function.