pyfilesystem
pyfilesystem copied to clipboard
Dokan needs to be more descriptive with it's error.
What steps will reproduce the problem?
1. Mount a file system with dokan
2. Kill the process without unmounting
3. Try to mount it again.
What is the expected output? What do you see instead?
Something like "Dokan can't mount that because it can't get a drive letter" or
"You need to clean up your last session with dokanctl /u DRIVE:".
Instead I see:
"Dokan failed with error: -5"
What version of the product are you using? On what operating system?
0.4.0 on Windows 7
Please provide any additional information below.
This is something better. It would display the error name and number instead
of just the number. It's hard to search google for a single negative number,
whereas you get a lot more results for "DOKAN_MOUNT_ERROR"
Index: fs/expose/dokan/__init__.py
===================================================================
--- fs/expose/dokan/__init__.py (revision 839)
+++ fs/expose/dokan/__init__.py (working copy)
@@ -105,7 +105,18 @@
DOKAN_DRIVER_INSTALL_ERROR = -3
DOKAN_START_ERROR = -4
DOKAN_MOUNT_ERROR = -5
+DOKAN_MOUNT_POINT_ERROR = -6
+DOKAN_ERROR_CODES = {# Error codes returned by DokanMain
+ 0: "DOKAN_SUCCESS",
+ -1: "DOKAN_ERROR",
+ -2: "DOKAN_DRIVE_LETTER_ERROR",
+ -3: "DOKAN_DRIVER_INSTALL_ERROR",
+ -4: "DOKAN_START_ERROR",
+ -5: "DOKAN_MOUNT_ERROR",
+ -6: "DOKAN_MOUNT_POINT_ERROR",
+}
+
# Misc windows constants
FILE_LIST_DIRECTORY = 0x01
FILE_SHARE_READ = 0x01
@@ -926,7 +937,7 @@
opstruct = ops.get_ops_struct()
res = libdokan.DokanMain(ctypes.byref(opts),ctypes.byref(opstruct))
if res != DOKAN_SUCCESS:
- raise OSError("Dokan failed with error: %d" % (res,))
+ raise OSError("Dokan failed with error: %d: %s" %
(res,DOKAN_ERROR_CODES[res],))
if unmount_callback:
unmount_callback()
# Running the background, spawn a subprocess and wait for it
Original issue reported on code.google.com by [email protected] on 20 Dec 2012 at 8:32
Oooh, sorry, I forgot to mention that I haven't tried that patch as I'm at home
and don't have access to a Windows machine here.
Also it adds -6, the DOKAN MOUNT POINT ERROR.
Original comment by [email protected] on 20 Dec 2012 at 8:33