printing: If we cannot contact Avahi, debug-log the error message

If we get a G_IO_ERROR_DBUS_ERROR here, we shouldn't make too much noise
about it by default, but it's still a useful data point for debugging
and diagnosis.

Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie 2024-10-15 15:26:38 +01:00
parent 0d650bd9d2
commit 7dc72303aa

View File

@ -3547,8 +3547,9 @@ avahi_service_browser_new_cb (GObject *source_object,
* The creation of ServiceBrowser fails with G_IO_ERROR_DBUS_ERROR
* if Avahi is disabled.
*/
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR))
g_debug ("%s #%d: %s", g_quark_to_string (error->domain), error->code, error->message);
else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("%s", error->message);
g_error_free (error);
}