From 93cf99e974ef8fd0b523bdd0f14ce39909966d80 Mon Sep 17 00:00:00 2001 From: Darksider3 Date: Fri, 1 Apr 2016 22:04:19 +0200 Subject: [PATCH 1/2] Improve Error-Messages in link.py ... by giving os-provided error messages to the output. --- plugins/link.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/link.py b/plugins/link.py index 30a77c9..359c2a0 100644 --- a/plugins/link.py +++ b/plugins/link.py @@ -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 From a7f24ef80eb592bf45cf10f12f581f2dae7dfb0b Mon Sep 17 00:00:00 2001 From: Darksider3 Date: Sun, 3 Apr 2016 13:13:38 +0200 Subject: [PATCH 2/2] link.py use _log.debug() instead of _log.warning() As suggested in #83 --- plugins/link.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/link.py b/plugins/link.py index 359c2a0..45b9c18 100644 --- a/plugins/link.py +++ b/plugins/link.py @@ -74,7 +74,7 @@ class Link(dotbot.Plugin): os.makedirs(parent) except OSError as err: self._log.warning('Failed to create directory %s' % parent) - self._log.warning('Error: %s.' % err.strerror) + self._log.debug('Error: %s.' % err.strerror) success = False else: self._log.lowinfo('Creating directory %s' % parent) @@ -100,7 +100,7 @@ class Link(dotbot.Plugin): removed = True except OSError as err: self._log.warning('Failed to remove %s' % path) - self._log.warning('Error: %s' %err.strerror) + self._log.debug('Error: %s' % err.strerror) success = False else: if removed: @@ -128,7 +128,7 @@ class Link(dotbot.Plugin): os.symlink(source, destination) except OSError as err: self._log.warning('Linking failed %s -> %s' % (link_name, source)) - self._log.warning('Error: %s' %err.strerror) + self._log.debug('Error: %s' % err.strerror) else: self._log.lowinfo('Creating link %s -> %s' % (link_name, source)) success = True