projects
/
kazan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
47e3c58
)
change json::Source::load_file to produce a more descriptive exception message
author
Jacob Lifshay
<programmerjake@gmail.com>
Thu, 29 Jun 2017 07:25:39 +0000
(
00:25
-0700)
committer
Jacob Lifshay
<programmerjake@gmail.com>
Thu, 29 Jun 2017 07:25:39 +0000
(
00:25
-0700)
src/json/source.cpp
patch
|
blob
|
history
diff --git
a/src/json/source.cpp
b/src/json/source.cpp
index 833bee1d884784c66157899dde864892336f83a2..93e7eba66758ad72240b662ef8d90bd035dcabae 100644
(file)
--- a/
src/json/source.cpp
+++ b/
src/json/source.cpp
@@
-102,8
+102,12
@@
Source Source::load_file(const util::filesystem::path &file_path)
{
// TODO: add code to use mmap
std::ifstream is;
- is.exceptions(std::ios::badbit
| std::ios::failbit
);
+ is.exceptions(std::ios::badbit);
is.open(file_path);
+ if(!is)
+ throw util::filesystem::filesystem_error(
+ "open failed", file_path, std::make_error_code(std::io_errc::stream));
+ is.exceptions(std::ios::badbit | std::ios::failbit);
std::vector<char> buffer;
while(is.peek() != std::char_traits<char>::eof())
{