diff options
Diffstat (limited to 'src/OSSupport/File.h')
-rw-r--r-- | src/OSSupport/File.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h index 62853ede7..59f3a5558 100644 --- a/src/OSSupport/File.h +++ b/src/OSSupport/File.h @@ -192,7 +192,17 @@ class FileStream final : public StreamType { public: - FileStream(const std::string & Path); + FileStream(const std::string & Path) + { + // Except on failbit, which is what open sets on failure: + FileStream::exceptions(FileStream::failbit | FileStream::badbit); + + // Open the file: + FileStream::open(Path); + + // Only subsequently except on serious errors, and not on conditions like EOF or malformed input: + FileStream::exceptions(FileStream::badbit); + } }; |