Improve error messages by prefixing them with context
The idea is coming from a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=2096069
There was an error "The name is not activatable", which comes from the D-Bus, but without a context (not only missing name of the service in question, because it can be also like :1.234
), to know what call was made, because without it the error message is useless.
There can be added g_prefix_error_literal()
or g_prefix_error()
calls around the code base to add such (localized) prefixes.
An example result can be: Failed to open address book: Failed to create D-Bus proxy: The name is not activatable
The tricky part is that the error from the downstream bug possibly comes from a 3rd-party library call, thus it's not only about adding the prefixes around g_dbus_error_strip_remote_error
calls (used 83 times at the time of writing this), but also on (many) other places.