mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
gio: Use g_task_return_error_literal() where we don't need formatting
This commit is contained in:
parent
7c71090723
commit
81068e5c00
@ -721,7 +721,7 @@ g_app_info_launch_uris_async (GAppInfo *appinfo,
|
||||
|
||||
task = g_task_new (appinfo, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, g_app_info_launch_uris_async);
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"Operation not supported for the current backend.");
|
||||
g_object_unref (task);
|
||||
|
||||
|
@ -1828,7 +1828,7 @@ send_message_data_deliver_error (GTask *task,
|
||||
send_message_with_reply_cleanup (task, TRUE);
|
||||
CONNECTION_UNLOCK (connection);
|
||||
|
||||
g_task_return_new_error (task, domain, code, "%s", message);
|
||||
g_task_return_new_error_literal (task, domain, code, message);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
@ -2386,7 +2386,7 @@ cancel_method_on_close (gpointer key, gpointer value, gpointer user_data)
|
||||
if (data->delivered)
|
||||
return FALSE;
|
||||
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CLOSED,
|
||||
_("The connection is closed"));
|
||||
|
@ -1030,10 +1030,12 @@ write_message_continue_writing (MessageToWriteData *data)
|
||||
if (!(data->worker->capabilities & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING))
|
||||
{
|
||||
GTask *task = g_steal_pointer (&data->task);
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Tried sending a file descriptor but remote peer does not support this capability");
|
||||
"Tried sending a file descriptor "
|
||||
"but remote peer does not support "
|
||||
"this capability");
|
||||
g_clear_object (&task);
|
||||
goto out;
|
||||
}
|
||||
|
@ -7721,9 +7721,9 @@ query_default_handler_query_app_info_for_type_cb (GObject *object,
|
||||
}
|
||||
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"%s", error->message);
|
||||
error->message);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7774,7 +7774,7 @@ query_default_handler_query_info_cb (GObject *object,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("No application is registered as handling this file"));
|
||||
|
@ -285,7 +285,8 @@ can_reach_async_got_address (GObject *object,
|
||||
else
|
||||
{
|
||||
/* Resolved all addresses, none matched */
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE,
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR,
|
||||
G_IO_ERROR_HOST_UNREACHABLE,
|
||||
_("Host unreachable"));
|
||||
g_object_unref (task);
|
||||
return;
|
||||
@ -321,7 +322,7 @@ g_network_monitor_base_can_reach_async (GNetworkMonitor *monitor,
|
||||
|
||||
if (g_hash_table_size (G_NETWORK_MONITOR_BASE (monitor)->priv->networks) == 0)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE,
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE,
|
||||
_("Network unreachable"));
|
||||
g_object_unref (task);
|
||||
return;
|
||||
|
@ -561,7 +561,7 @@ can_reach_done (GObject *source,
|
||||
if (reachable)
|
||||
g_task_return_boolean (task, TRUE);
|
||||
else
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE,
|
||||
"Can't reach host");
|
||||
|
||||
|
@ -182,11 +182,11 @@ response_received (GDBusConnection *connection,
|
||||
g_task_return_boolean (task, TRUE);
|
||||
break;
|
||||
case XDG_DESKTOP_PORTAL_CANCELLED:
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Launch cancelled");
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_CANCELLED, "Launch cancelled");
|
||||
break;
|
||||
case XDG_DESKTOP_PORTAL_FAILED:
|
||||
default:
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Launch failed");
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Launch failed");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1764,7 +1764,7 @@ g_output_stream_splice_async (GOutputStream *stream,
|
||||
|
||||
if (g_input_stream_is_closed (source))
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR, G_IO_ERROR_CLOSED,
|
||||
_("Source stream is already closed"));
|
||||
g_object_unref (task);
|
||||
|
@ -343,9 +343,14 @@ complete_async (GTask *task)
|
||||
priv->last_error = NULL;
|
||||
}
|
||||
else if (!priv->ever_enumerated)
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, _("Unspecified proxy lookup failure"));
|
||||
{
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
_("Unspecified proxy lookup failure"));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_task_return_pointer (task, NULL, NULL);
|
||||
}
|
||||
|
||||
priv->ever_enumerated = TRUE;
|
||||
|
||||
|
@ -724,7 +724,7 @@ nego_reply_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
@ -837,7 +837,7 @@ auth_reply_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
@ -949,7 +949,7 @@ connect_reply_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
@ -1019,7 +1019,7 @@ connect_addr_len_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
@ -1055,7 +1055,7 @@ connect_addr_read_cb (GObject *source,
|
||||
|
||||
if (read == 0)
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_CONNECTION_CLOSED,
|
||||
"Connection to SOCKSv5 proxy server lost");
|
||||
|
@ -1448,8 +1448,10 @@ timeout_cb (gpointer user_data)
|
||||
g_mutex_unlock (&data->lock);
|
||||
|
||||
if (should_return)
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
|
||||
{
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
|
||||
_("Socket I/O timed out"));
|
||||
}
|
||||
|
||||
/* Signal completion of the task. */
|
||||
g_mutex_lock (&data->lock);
|
||||
|
@ -262,7 +262,7 @@ eject_unmount_done (GObject *source,
|
||||
{
|
||||
if (!g_subprocess_get_successful (subprocess))
|
||||
/* ...but bad exit code */
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED, stderr_str);
|
||||
else
|
||||
/* ...and successful exit code */
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
@ -287,7 +287,7 @@ eject_mount_done (GObject *source,
|
||||
{
|
||||
if (!g_subprocess_get_successful (subprocess))
|
||||
/* ...but bad exit code */
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
|
||||
g_task_return_new_error_literal (task, G_IO_ERROR, G_IO_ERROR_FAILED, stderr_str);
|
||||
else
|
||||
{
|
||||
/* ...and successful exit code */
|
||||
|
@ -797,7 +797,7 @@ g_fake_resolver_lookup_by_name_async (GResolver *resolver,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_task_return_new_error (task,
|
||||
g_task_return_new_error_literal (task,
|
||||
G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
|
||||
"Not found");
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ test_interaction_ask_password_async_failure (GTlsInteraction *interaction,
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
|
||||
g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_ACCES, "The message");
|
||||
g_task_return_new_error_literal (task, G_FILE_ERROR, G_FILE_ERROR_ACCES, "The message");
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ test_interaction_request_certificate_async_failure (GTlsInteraction *interact
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
|
||||
g_task_return_new_error (task, G_FILE_ERROR, G_FILE_ERROR_NOENT, "Another message");
|
||||
g_task_return_new_error_literal (task, G_FILE_ERROR, G_FILE_ERROR_NOENT, "Another message");
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user