mirror of
https://github.com/boostorg/regex.git
synced 2025-07-17 06:12:10 +02:00
Changed no-exception behaviour to call throw_exception directly so that the handler sees the actual error message.
[SVN r20361]
This commit is contained in:
@ -375,15 +375,12 @@ void BOOST_REGEX_CALL re_message_update()
|
||||
if(*boost::re_detail::c_traits_base::get_catalogue())
|
||||
{
|
||||
message_cat = catopen(boost::re_detail::c_traits_base::get_catalogue(), 0);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(message_cat == (nl_catd)-1)
|
||||
{
|
||||
std::string m("Unable to open message catalog: ");
|
||||
throw std::runtime_error(m + boost::re_detail::c_traits_base::get_catalogue());
|
||||
std::runtime_error err(m + boost::re_detail::c_traits_base::get_catalogue());
|
||||
boost::throw_exception(err);
|
||||
}
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(message_cat != (nl_catd)-1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
for(int i = 0; i < boost::REG_E_UNKNOWN; ++i)
|
||||
|
@ -205,15 +205,12 @@ message_data<char>::message_data(const std::locale& l, std::string regex_message
|
||||
{
|
||||
pm = &BOOST_USE_FACET(std::messages<char>, l);
|
||||
cat = pm->open(regex_message_catalogue, l);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(cat < 0)
|
||||
{
|
||||
std::string m("Unable to open message catalog: ");
|
||||
throw std::runtime_error(m + regex_message_catalogue);
|
||||
std::runtime_error err(m + regex_message_catalogue);
|
||||
boost::throw_exception(err);
|
||||
}
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(cat >= 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
std::memset(syntax_map, cpp_regex_traits<char>::syntax_char, 256);
|
||||
@ -613,15 +610,12 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
|
||||
if(regex_message_catalogue.size())
|
||||
{
|
||||
cat = msgs.open(regex_message_catalogue, l);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(cat < 0)
|
||||
{
|
||||
std::string m("Unable to open message catalog: ");
|
||||
throw std::runtime_error(m + regex_message_catalogue);
|
||||
std::runtime_error err(m + regex_message_catalogue);
|
||||
boost::throw_exception(err);
|
||||
}
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(cat >= 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
scoped_array<char> a;
|
||||
|
@ -83,11 +83,8 @@ void mapfile::open(const char* file)
|
||||
CloseHandle(hfile);
|
||||
hmap = 0;
|
||||
hfile = 0;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw std::runtime_error("Unable to create file mapping.");
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(hmap != INVALID_HANDLE_VALUE);
|
||||
#endif
|
||||
std::runtime_error err("Unable to create file mapping.");
|
||||
boost::throw_exception(err);
|
||||
}
|
||||
_first = static_cast<const char*>(MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0));
|
||||
if(_first == 0)
|
||||
@ -96,11 +93,7 @@ void mapfile::open(const char* file)
|
||||
CloseHandle(hfile);
|
||||
hmap = 0;
|
||||
hfile = 0;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw std::runtime_error("Unable to create file mapping.");
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(_first != 0);
|
||||
#endif
|
||||
std::runtime_error err("Unable to create file mapping.");
|
||||
}
|
||||
_last = _first + GetFileSize(hfile, 0);
|
||||
}
|
||||
@ -322,11 +315,7 @@ void mapfile::open(const char* file)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw std::runtime_error("Unable to open file.");
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(hfile != 0);
|
||||
#endif
|
||||
std::runtime_error err("Unable to open file.");
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}catch(...)
|
||||
|
@ -236,15 +236,12 @@ void BOOST_REGEX_CALL w32_traits_base::do_init()
|
||||
if(*regex_message_catalogue)
|
||||
{
|
||||
hresmod = LoadLibraryA(regex_message_catalogue);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(hresmod == NULL)
|
||||
{
|
||||
std::string s("Unable to open dll: ");
|
||||
throw std::runtime_error(s + regex_message_catalogue);
|
||||
std::runtime_error err(s + regex_message_catalogue);
|
||||
boost::throw_exception(err);
|
||||
}
|
||||
#else
|
||||
BOOST_REGEX_NOEH_ASSERT(hresmod != NULL);
|
||||
#endif
|
||||
}
|
||||
unsigned int i;
|
||||
for(i = 0; i < REG_E_UNKNOWN; ++i)
|
||||
|
Reference in New Issue
Block a user