Use BOOST_THROW_EXCEPTION

fix #370
This commit is contained in:
Vinnie Falco
2017-05-24 12:36:07 -07:00
parent e76281867d
commit bf0145da67
31 changed files with 174 additions and 156 deletions
+9 -8
View File
@@ -21,6 +21,7 @@
#include <boost/asio/handler_continuation_hook.hpp>
#include <boost/asio/handler_invoke_hook.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <memory>
#include <type_traits>
@@ -316,7 +317,7 @@ accept()
error_code ec;
accept(ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -333,7 +334,7 @@ accept_ex(ResponseDecorator const& decorator)
error_code ec;
accept_ex(decorator, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -376,7 +377,7 @@ accept(ConstBufferSequence const& buffers)
error_code ec;
accept(buffers, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -398,7 +399,7 @@ accept_ex(ConstBufferSequence const& buffers,
error_code ec;
accept_ex(buffers, decorator, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -457,7 +458,7 @@ accept(http::header<true, Fields> const& req)
error_code ec;
accept(req, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -475,7 +476,7 @@ accept_ex(http::header<true, Fields> const& req,
error_code ec;
accept_ex(req, decorator, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -522,7 +523,7 @@ accept(http::header<true, Fields> const& req,
error_code ec;
accept(req, buffers, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -545,7 +546,7 @@ accept_ex(http::header<true, Fields> const& req,
error_code ec;
accept_ex(req, buffers, decorator, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
+2 -1
View File
@@ -14,6 +14,7 @@
#include <boost/asio/handler_alloc_hook.hpp>
#include <boost/asio/handler_continuation_hook.hpp>
#include <boost/asio/handler_invoke_hook.hpp>
#include <boost/throw_exception.hpp>
#include <memory>
namespace beast {
@@ -227,7 +228,7 @@ close(close_reason const& cr)
error_code ec;
close(cr, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
+5 -4
View File
@@ -18,6 +18,7 @@
#include <boost/asio/handler_continuation_hook.hpp>
#include <boost/asio/handler_invoke_hook.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <memory>
namespace beast {
@@ -265,7 +266,7 @@ handshake(string_view const& host,
handshake(
host, target, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -280,7 +281,7 @@ handshake(response_type& res,
error_code ec;
handshake(res, host, target, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -299,7 +300,7 @@ handshake_ex(string_view const& host,
error_code ec;
handshake_ex(host, target, decorator, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -319,7 +320,7 @@ handshake_ex(response_type& res,
error_code ec;
handshake_ex(res, host, target, decorator, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
+3 -2
View File
@@ -15,6 +15,7 @@
#include <boost/asio/handler_alloc_hook.hpp>
#include <boost/asio/handler_continuation_hook.hpp>
#include <boost/asio/handler_invoke_hook.hpp>
#include <boost/throw_exception.hpp>
#include <memory>
namespace beast {
@@ -240,7 +241,7 @@ ping(ping_data const& payload)
error_code ec;
ping(payload, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -262,7 +263,7 @@ pong(ping_data const& payload)
error_code ec;
pong(payload, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
+3 -2
View File
@@ -19,6 +19,7 @@
#include <boost/asio/handler_invoke_hook.hpp>
#include <boost/assert.hpp>
#include <boost/optional.hpp>
#include <boost/throw_exception.hpp>
#include <limits>
#include <memory>
@@ -721,7 +722,7 @@ read_frame(frame_info& fi, DynamicBuffer& buffer)
error_code ec;
read_frame(fi, buffer, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -1136,7 +1137,7 @@ read(opcode& op, DynamicBuffer& buffer)
error_code ec;
read(op, buffer, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
+9 -8
View File
@@ -23,6 +23,7 @@
#include <beast/core/detail/type_traits.hpp>
#include <boost/assert.hpp>
#include <boost/endian/buffers.hpp>
#include <boost/throw_exception.hpp>
#include <algorithm>
#include <memory>
#include <stdexcept>
@@ -48,20 +49,20 @@ set_option(permessage_deflate const& o)
{
if( o.server_max_window_bits > 15 ||
o.server_max_window_bits < 9)
throw std::invalid_argument{
"invalid server_max_window_bits"};
BOOST_THROW_EXCEPTION(std::invalid_argument{
"invalid server_max_window_bits"});
if( o.client_max_window_bits > 15 ||
o.client_max_window_bits < 9)
throw std::invalid_argument{
"invalid client_max_window_bits"};
BOOST_THROW_EXCEPTION(std::invalid_argument{
"invalid client_max_window_bits"});
if( o.compLevel < 0 ||
o.compLevel > 9)
throw std::invalid_argument{
"invalid compLevel"};
BOOST_THROW_EXCEPTION(std::invalid_argument{
"invalid compLevel"});
if( o.memLevel < 1 ||
o.memLevel > 9)
throw std::invalid_argument{
"invalid memLevel"};
BOOST_THROW_EXCEPTION(std::invalid_argument{
"invalid memLevel"});
pmd_opts_ = o;
}
+3 -2
View File
@@ -21,6 +21,7 @@
#include <boost/asio/handler_continuation_hook.hpp>
#include <boost/asio/handler_invoke_hook.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <algorithm>
#include <memory>
@@ -580,7 +581,7 @@ write_frame(bool fin, ConstBufferSequence const& buffers)
error_code ec;
write_frame(fin, buffers, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>
@@ -932,7 +933,7 @@ write(ConstBufferSequence const& buffers)
error_code ec;
write(buffers, ec);
if(ec)
throw system_error{ec};
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer>