After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725203 - Filesystem plugin bug fixes
Filesystem plugin bug fixes
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
unspecified
Other All
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2014-02-26 09:32 UTC by Bastien Nocera
Modified: 2014-06-13 22:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
filesystem: Bail out early for cancelled operations (1018 bytes, patch)
2014-02-26 09:32 UTC, Bastien Nocera
committed Details | Review
filesystem: Better error message when browsing fails (2.13 KB, patch)
2014-02-26 09:32 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-02-26 09:32:26 UTC
.
Comment 1 Bastien Nocera 2014-02-26 09:32:29 UTC
Created attachment 270358 [details] [review]
filesystem: Bail out early for cancelled operations
Comment 2 Bastien Nocera 2014-02-26 09:32:34 UTC
Created attachment 270359 [details] [review]
filesystem: Better error message when browsing fails

We try to keep the original error domain and code, so that
interested front-ends can act upon the errors. For example,
a G_IO_ERROR/G_IO_ERROR_NOT_MOUNTED error could trigger something
to mount the item.
Comment 3 Juan A. Suarez Romero 2014-02-28 19:11:21 UTC
Comment on attachment 270358 [details] [review]
filesystem: Bail out early for cancelled operations

Attachment 270358 [details] pushed as 44f81e4 - filesystem: Bail out early for cancelled operations
Comment 4 Juan A. Suarez Romero 2014-02-28 19:19:20 UTC
Review of attachment 270359 [details] [review]:

::: src/filesystem/grl-filesystem.c
@@ +1147,3 @@
+    GError *error_new = g_error_new (error->domain,
+                                     error->code,
+                                     _("File %s does not exist"),

While I understand the point of this commit, I think it is enough with keeping the error->code. After all it is prefixed with G_IO_ERROR_ so it is clear the error comes from GIO, and has enough information with this. I would keep the domain as GRL_CORE_ERROR, like originally, because from application pov it is grilo who creates the error. So instead of having G_IO_ERROR/G_IO_ERROR_NOT_MOUNTED  we would have GRL_CORE_ERROR/G_IO_ERROR_NOT_MOUNTED, which provides the information we need.

Also, should we create our own custom "File %s does not exist" message, or rather use the original error message?
Comment 5 Bastien Nocera 2014-03-27 18:15:19 UTC
(In reply to comment #4)
> Review of attachment 270359 [details] [review]:
> 
> ::: src/filesystem/grl-filesystem.c
> @@ +1147,3 @@
> +    GError *error_new = g_error_new (error->domain,
> +                                     error->code,
> +                                     _("File %s does not exist"),
> 
> While I understand the point of this commit, I think it is enough with keeping
> the error->code. After all it is prefixed with G_IO_ERROR_ so it is clear the
> error comes from GIO, and has enough information with this. I would keep the
> domain as GRL_CORE_ERROR, like originally, because from application pov it is
> grilo who creates the error. So instead of having
> G_IO_ERROR/G_IO_ERROR_NOT_MOUNTED  we would have
> GRL_CORE_ERROR/G_IO_ERROR_NOT_MOUNTED, which provides the information we need.

You can't mix and match error codes from different domains. G_IO_ERROR_NOT_MOUNTED is error code 16. GRL_CORE_ERROR_NOTIFY_CHANGED_FAILED is error code 16 for the GRL_ERROR domain.

> Also, should we create our own custom "File %s does not exist" message, or
> rather use the original error message?

The GIO error message is probably too technical and likely lacks the URL, which is why I simplified it. This is basically the exact same error, but with the original domain and error code so that front-ends can try and fix the problem (such as starting a mount).
Comment 6 Juan A. Suarez Romero 2014-06-05 17:14:09 UTC
(In reply to comment #5)
> The GIO error message is probably too technical and likely lacks the URL, which
> is why I simplified it. This is basically the exact same error, but with the
> original domain and error code so that front-ends can try and fix the problem
> (such as starting a mount).

And is this correct? When developing a library AB that is using internally another library XZ, is it correct to expose GErrors from XZ directly using the domain/code from XZ, instead of AB? Shouldn't we use XZ domain/code, which is what the application actually use?
Comment 7 Bastien Nocera 2014-06-05 17:24:09 UTC
I think it's fine, if you mention in the API documentation that errors might be from domain AB and from domain XZ. There are a number of APIs in GLib/GIO that do that.
Comment 8 Juan A. Suarez Romero 2014-06-13 22:18:36 UTC
Attachment 270359 [details] pushed as 9abd83d - filesystem: Better error message when browsing fails