forked from seba/servefile
Do not swallow exceptions that can be helpful in error messages
This commit is contained in:
parent
2886d1fb07
commit
affa42dae8
|
@ -891,8 +891,8 @@ class ServeFile():
|
||||||
try:
|
try:
|
||||||
testit = open(self.target, 'r')
|
testit = open(self.target, 'r')
|
||||||
testit.close()
|
testit.close()
|
||||||
except IOError:
|
except IOError as e:
|
||||||
raise ServeFileException("Error: Could not open file!")
|
raise ServeFileException("Error: Could not open file, %r" % e)
|
||||||
FileHandler.filePath = self.target
|
FileHandler.filePath = self.target
|
||||||
FileHandler.fileName = os.path.basename(self.target)
|
FileHandler.fileName = os.path.basename(self.target)
|
||||||
FileHandler.fileLength = os.stat(self.target).st_size
|
FileHandler.fileLength = os.stat(self.target).st_size
|
||||||
|
@ -912,8 +912,8 @@ class ServeFile():
|
||||||
self.dirCreated = True
|
self.dirCreated = True
|
||||||
try:
|
try:
|
||||||
os.mkdir(self.target)
|
os.mkdir(self.target)
|
||||||
except (IOError, OSError):
|
except (IOError, OSError) as e:
|
||||||
raise ServeFileException("Error: Could not create directory '%s' for uploads." % (self.target,))
|
raise ServeFileException("Error: Could not create directory '%s' for uploads, %r" % (self.target, e))
|
||||||
else:
|
else:
|
||||||
raise ServeFileException("Error: Upload directory already exists and is a file.")
|
raise ServeFileException("Error: Upload directory already exists and is a file.")
|
||||||
FilePutter.targetDir = self.target
|
FilePutter.targetDir = self.target
|
||||||
|
|
Loading…
Reference in New Issue