Skip to content

Commit

Permalink
Merge pull request #11 from johnkeeping/catch-by-ref
Browse files Browse the repository at this point in the history
Catch exceptions by const reference
  • Loading branch information
ferdymercury authored Nov 5, 2020
2 parents e90f4a8 + a35cb29 commit a55d56e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/test-strict_fstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void test_open(const std::string& stream_class, const std::string& stream_type,
s_p->open(filename, static_cast< std::ios_base::openmode >(mode));
exception_thrown = false;
}
catch (std::exception) {}
catch (const std::exception &) {}
std::cout << stream_class << " " << stream_type << " " << (set_fail_bit? "failbit" : "nofailbit") << " "
<< strict_fstream::detail::static_method_holder::mode_to_string(
static_cast< std::ios_base::openmode >(mode))
Expand Down
2 changes: 1 addition & 1 deletion src/strict_fstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct static_method_holder
is_p->peek();
peek_failed = is_p->fail();
}
catch (std::ios_base::failure e) {}
catch (const std::ios_base::failure &e) {}
if (peek_failed)
{
throw Exception(std::string("strict_fstream: open('")
Expand Down

0 comments on commit a55d56e

Please sign in to comment.