From affa42dae85cf1bb16e57479fed565d9771ccf70 Mon Sep 17 00:00:00 2001 From: Robert Buchholz Date: Thu, 18 Oct 2012 10:24:44 +0200 Subject: [PATCH] Do not swallow exceptions that can be helpful in error messages --- servefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/servefile b/servefile index deb8b76..17ce8c4 100755 --- a/servefile +++ b/servefile @@ -891,8 +891,8 @@ class ServeFile(): try: testit = open(self.target, 'r') testit.close() - except IOError: - raise ServeFileException("Error: Could not open file!") + except IOError as e: + raise ServeFileException("Error: Could not open file, %r" % e) FileHandler.filePath = self.target FileHandler.fileName = os.path.basename(self.target) FileHandler.fileLength = os.stat(self.target).st_size @@ -912,8 +912,8 @@ class ServeFile(): self.dirCreated = True try: os.mkdir(self.target) - except (IOError, OSError): - raise ServeFileException("Error: Could not create directory '%s' for uploads." % (self.target,)) + except (IOError, OSError) as e: + raise ServeFileException("Error: Could not create directory '%s' for uploads, %r" % (self.target, e)) else: raise ServeFileException("Error: Upload directory already exists and is a file.") FilePutter.targetDir = self.target