[PATCH] sb: Make error messages unique

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jun 14 08:10:53 UTC 2017


Enable traceability from the error message to the script location.  This
eases debugging.
---
 source-builder/sb/path.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py
index 43f41eb..2c20248 100644
--- a/source-builder/sb/path.py
+++ b/source-builder/sb/path.py
@@ -179,7 +179,7 @@ def copy(src, dst):
             if WindowsError is not None and isinstance(why, WindowsError):
                 pass
         else:
-            raise error.general('copying tree: %s -> %s: %s' % (hsrc, hdst, str(why)))
+            raise error.general('copying tree (1): %s -> %s: %s' % (hsrc, hdst, str(why)))
 
 def copy_tree(src, dst):
     trace = False
@@ -233,10 +233,10 @@ def copy_tree(src, dst):
             else:
                     shutil.copy2(host(srcname), host(dstname))
         except shutil.Error as err:
-            raise error.general('copying tree: %s -> %s: %s' % \
+            raise error.general('copying tree (2): %s -> %s: %s' % \
                                 (hsrc, hdst, str(err)))
         except EnvironmentError as why:
-            raise error.general('copying tree: %s -> %s: %s' % \
+            raise error.general('copying tree (3): %s -> %s: %s' % \
                                 (srcname, dstname, str(why)))
     try:
         shutil.copystat(hsrc, hdst)
@@ -245,7 +245,7 @@ def copy_tree(src, dst):
             if WindowsError is not None and isinstance(why, WindowsError):
                 pass
         else:
-            raise error.general('copying tree: %s -> %s: %s' % (hsrc, hdst, str(why)))
+            raise error.general('copying tree (4): %s -> %s: %s' % (hsrc, hdst, str(why)))
 
 if __name__ == '__main__':
     print(host('/a/b/c/d-e-f'))
-- 
2.12.3



More information about the devel mailing list