summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-01-15 23:52:14 +0000
committerChris Wilson <chris+github@qwirx.com>2007-01-15 23:52:14 +0000
commit573891c9d60d0556e8caa09f0580d0f7c0e9b320 (patch)
treec6d40781108b905bdd25cec448a42581df572207 /lib/common
parentbc79aea4297aa986e1810b56e19497c7beb0f6a2 (diff)
Throw CommonException AccessDenied if we didn't get access to the file,
for better error description (refs #3)
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/FileStream.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/common/FileStream.cpp b/lib/common/FileStream.cpp
index 89ae7a1f..8040cab4 100644
--- a/lib/common/FileStream.cpp
+++ b/lib/common/FileStream.cpp
@@ -11,6 +11,8 @@
#include "FileStream.h"
#include "CommonException.h"
+#include <errno.h>
+
#include "MemLeakFindOn.h"
// --------------------------------------------------------------------------
@@ -36,7 +38,15 @@ FileStream::FileStream(const char *Filename, int flags, int mode)
#endif
{
MEMLEAKFINDER_NOT_A_LEAK(this);
- THROW_EXCEPTION(CommonException, OSFileOpenError)
+
+ if(errno == EACCES)
+ {
+ THROW_EXCEPTION(CommonException, AccessDenied)
+ }
+ else
+ {
+ THROW_EXCEPTION(CommonException, OSFileOpenError)
+ }
}
#ifdef WIN32
this->fileName = Filename;