mirror of
1
0
Fork 0

Improve Error-Messages in link.py

... by giving os-provided error messages to the output.
This commit is contained in:
Darksider3 2016-04-01 22:04:19 +02:00
parent 3d9b3ae2a8
commit 93cf99e974
1 changed files with 6 additions and 3 deletions

View File

@ -72,8 +72,9 @@ class Link(dotbot.Plugin):
if not self._exists(parent):
try:
os.makedirs(parent)
except OSError:
except OSError as err:
self._log.warning('Failed to create directory %s' % parent)
self._log.warning('Error: %s.' % err.strerror)
success = False
else:
self._log.lowinfo('Creating directory %s' % parent)
@ -97,8 +98,9 @@ class Link(dotbot.Plugin):
else:
os.remove(fullpath)
removed = True
except OSError:
except OSError as err:
self._log.warning('Failed to remove %s' % path)
self._log.warning('Error: %s' %err.strerror)
success = False
else:
if removed:
@ -124,8 +126,9 @@ class Link(dotbot.Plugin):
destination_dir = os.path.dirname(destination)
source = os.path.relpath(source, destination_dir)
os.symlink(source, destination)
except OSError:
except OSError as err:
self._log.warning('Linking failed %s -> %s' % (link_name, source))
self._log.warning('Error: %s' %err.strerror)
else:
self._log.lowinfo('Creating link %s -> %s' % (link_name, source))
success = True