[meld] iohelpers: Handle trash-related errors with NFS mounts (#268)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] iohelpers: Handle trash-related errors with NFS mounts (#268)
- Date: Tue, 8 Jan 2019 22:41:10 +0000 (UTC)
commit a70290c723a4b2f38a7360163ebb80eb0fc9641c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Wed Jan 9 08:35:30 2019 +1000
iohelpers: Handle trash-related errors with NFS mounts (#268)
NFS gives a different error code to other network mounts for some
reason. Annoyingly, it's a generic error code so while I'm hesitant to
blanket handle it like this... really we're putting up a confirmation
dialog here so it's not the worst thing.
meld/iohelpers.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/meld/iohelpers.py b/meld/iohelpers.py
index e4f74b2e..53006475 100644
--- a/meld/iohelpers.py
+++ b/meld/iohelpers.py
@@ -25,9 +25,15 @@ def trash_or_confirm(gfile: Gio.File) -> bool:
gfile.trash(None)
return True
except GLib.GError as e:
- # Only handle not-supported, as that's due to trashing
- # the target mount-point, not an underlying problem.
- if e.code != Gio.IOErrorEnum.NOT_SUPPORTED:
+ # Handle not-supported, as that's due to the trashing target
+ # being a (probably network) mount-point, not an underlying
+ # problem. We also have to handle the generic FAILED code
+ # because that's what we get with NFS mounts.
+ expected_error = (
+ e.code == Gio.IOErrorEnum.NOT_SUPPORTED or
+ e.code == Gio.IOErrorEnum.FAILED
+ )
+ if not expected_error:
raise RuntimeError(str(e))
file_type = gfile.query_file_type(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]