Skip to content

Commit 44911cd

Browse files
committed
fixup throw macro
1 parent 524956e commit 44911cd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/boost/regex/v5/perl_matcher.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
#endif
4141

4242
#ifndef BOOST_REGEX_STANDALONE
43-
# define BOOST_REGEX_DETAIL_THROW(msg) boost::throw_exception(std::logic_error(msg))
43+
# define BOOST_REGEX_DETAIL_THROW(ex) boost::throw_exception(ex)
4444
#else
45-
# define BOOST_REGEX_DETAIL_THROW(msg) throw std::logic_error(msg)
45+
# define BOOST_REGEX_DETAIL_THROW(ex) throw ex
4646
#endif
4747

4848
namespace boost{
@@ -58,15 +58,15 @@ inline void verify_options(boost::regex_constants::syntax_option_type, match_fla
5858

5959
if (is_perl && is_posix)
6060
{
61-
BOOST_REGEX_DETAIL_THROW("Usage Error: Can't mix Perl and POSIX matching rules");
61+
BOOST_REGEX_DETAIL_THROW(std::logic_error("Usage Error: Can't mix Perl and POSIX matching rules"));
6262
}
6363

6464
//
6565
// can't mix match_extra with POSIX matching rules:
6666
//
6767
if ((mf & match_extra) && is_posix)
6868
{
69-
BOOST_REGEX_DETAIL_THROW("Usage Error: Can't mix regular expression captures with POSIX matching rules");
69+
BOOST_REGEX_DETAIL_THROW(std::logic_error("Usage Error: Can't mix regular expression captures with POSIX matching rules"));
7070
}
7171
}
7272
//

include/boost/regex/v5/perl_matcher_common.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
6060
if(e.empty())
6161
{
6262
// precondition failure: e is not a valid regex.
63-
BOOST_REGEX_DETAIL_THROW("Invalid regular expression object");
63+
BOOST_REGEX_DETAIL_THROW(std::invalid_argument("Invalid regular expression object"));
6464
}
6565
pstate = 0;
6666
m_match_flags = f;
@@ -95,7 +95,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
9595
if(e.get_data().m_disable_match_any)
9696
{
9797
if (m_match_flags & match_posix)
98-
BOOST_REGEX_DETAIL_THROW("Invalid regex for POSIX-style matching");
98+
BOOST_REGEX_DETAIL_THROW(std::logic_error("Invalid regex for POSIX-style matching"));
9999
m_match_flags &= regex_constants::match_not_any;
100100
}
101101
}

0 commit comments

Comments
 (0)