Improve Error-Messages in link.py
... by giving os-provided error messages to the output.
This commit is contained in:
parent
3d9b3ae2a8
commit
93cf99e974
1 changed files with 6 additions and 3 deletions
|
@ -72,8 +72,9 @@ class Link(dotbot.Plugin):
|
||||||
if not self._exists(parent):
|
if not self._exists(parent):
|
||||||
try:
|
try:
|
||||||
os.makedirs(parent)
|
os.makedirs(parent)
|
||||||
except OSError:
|
except OSError as err:
|
||||||
self._log.warning('Failed to create directory %s' % parent)
|
self._log.warning('Failed to create directory %s' % parent)
|
||||||
|
self._log.warning('Error: %s.' % err.strerror)
|
||||||
success = False
|
success = False
|
||||||
else:
|
else:
|
||||||
self._log.lowinfo('Creating directory %s' % parent)
|
self._log.lowinfo('Creating directory %s' % parent)
|
||||||
|
@ -97,8 +98,9 @@ class Link(dotbot.Plugin):
|
||||||
else:
|
else:
|
||||||
os.remove(fullpath)
|
os.remove(fullpath)
|
||||||
removed = True
|
removed = True
|
||||||
except OSError:
|
except OSError as err:
|
||||||
self._log.warning('Failed to remove %s' % path)
|
self._log.warning('Failed to remove %s' % path)
|
||||||
|
self._log.warning('Error: %s' %err.strerror)
|
||||||
success = False
|
success = False
|
||||||
else:
|
else:
|
||||||
if removed:
|
if removed:
|
||||||
|
@ -124,8 +126,9 @@ class Link(dotbot.Plugin):
|
||||||
destination_dir = os.path.dirname(destination)
|
destination_dir = os.path.dirname(destination)
|
||||||
source = os.path.relpath(source, destination_dir)
|
source = os.path.relpath(source, destination_dir)
|
||||||
os.symlink(source, destination)
|
os.symlink(source, destination)
|
||||||
except OSError:
|
except OSError as err:
|
||||||
self._log.warning('Linking failed %s -> %s' % (link_name, source))
|
self._log.warning('Linking failed %s -> %s' % (link_name, source))
|
||||||
|
self._log.warning('Error: %s' %err.strerror)
|
||||||
else:
|
else:
|
||||||
self._log.lowinfo('Creating link %s -> %s' % (link_name, source))
|
self._log.lowinfo('Creating link %s -> %s' % (link_name, source))
|
||||||
success = True
|
success = True
|
||||||
|
|
Loading…
Reference in a new issue