How does one decode GError?


I called g_dbus_connection_call_sync and the returned error->message indicated a timeout.

I printed error->code as an integer, and it was 24. I printed G_DBUS_ERROR_TIMED_OUT and it had a value of 20.

Since G_DBUS_TIMEOUT is even earlier in the enum, how do I decode this? Do I also need to look at the domain?

Yes, you need to look at the error domain. Error codes are meaningful only within an error domain.

For example, if the error domain is G_IO_ERROR, then error code 24 would correspond to G_IO_ERROR_TIMED_OUT. That’s surely what you’ve got! You’re dealing with a GIOError, and not a GDBusError.

I did a search on G_IO_ERROR, and found this:

So I think g_error_matches() is what I need to use.


You likely want to read the GLib documentation on error reporting as well.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.