MountStorage: Better error reporting
Created a new resolver frontend function, that raises and error, when no backend is found. Useful for all the wrappers.
This commit is contained in:
parent
926aec1473
commit
eea315623f
@ -227,7 +227,7 @@ class MountStorage(StorageInterface):
|
||||
new_ent = clean_listy_filepath(dirpath)
|
||||
|
||||
print "Mounting:", repr(new_ent)
|
||||
already, rem_1, table, rem_2 = self.resolve_to_backend(new_ent, True)
|
||||
already, rem_1, table, rem_2 = self._resolve_to_backend(new_ent, True)
|
||||
print "===", repr(already), repr(rem_1), repr(rem_2)
|
||||
|
||||
assert (already is None) or (len(rem_2) > 0), "Already mounted"
|
||||
@ -237,7 +237,7 @@ class MountStorage(StorageInterface):
|
||||
assert not table.has_key(None), "Huh? Already mounted?!"
|
||||
table[None] = backend
|
||||
|
||||
def resolve_to_backend(self, filepath, extra_info = False):
|
||||
def _resolve_to_backend(self, filepath, extra_info = False):
|
||||
"""
|
||||
extra_info = True is for internal use!
|
||||
|
||||
@ -270,6 +270,12 @@ class MountStorage(StorageInterface):
|
||||
else:
|
||||
return (res_be, res_fp)
|
||||
|
||||
def resolve_to_backend(self, filepath):
|
||||
backend, filepath = self._resolve_to_backend(filepath)
|
||||
if backend is None:
|
||||
raise Error("Path not mounted")
|
||||
return backend, filepath
|
||||
|
||||
def __repr__(self, table = None, indent = []):
|
||||
res = []
|
||||
if table is None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user