Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   Improve the error messages in SmartCopy (http://www.linux-archive.org/gentoo-user/331951-improve-error-messages-smartcopy.html)

Martin Gracik 02-25-2010 05:15 PM

Improve the error messages in SmartCopy
 
---
src/pylorax/sysutils.py | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/pylorax/sysutils.py b/src/pylorax/sysutils.py
index f80018b..e63757c 100644
--- a/src/pylorax/sysutils.py
+++ b/src/pylorax/sysutils.py
@@ -325,10 +325,20 @@ class SmartCopy(object):
os.unlink(dst)

# copy all the files
- map(lambda (src, dst): shutil.copy2(src, dst), self.copyfiles)
+ try:
+ map(lambda (src, dst): shutil.copy2(src, dst), self.copyfiles)
+ except shutil.Error as why:
+ err_msg = "error copying file {0} -> {1}: {2}"
+ err_msg = err_msg.format(src, dst, why)
+ raise SmartCopyError(err_msg)

# create symlinks
- map(lambda (target, name): symlink_(target, name), self.links)
+ try:
+ map(lambda (target, name): symlink_(target, name), self.links)
+ except OSError as why:
+ err_msg = "error creating symlink {0} -> {1}: {2}"
+ err_msg = err_msg.format(name, target, why)
+ raise SmartCopyError(err_msg)


# XXX
--
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 07:10 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.