diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5b6b297e..ac9e3bfe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
* Add Secure WebSocket example
* Fix message_v1 constructor
* Tidy up DynamicBuffer requirements
+* Tidy up error types and headers
--------------------------------------------------------------------------------
diff --git a/doc/quickref.xml b/doc/quickref.xml
index 6bee93b8..2b070f6b 100644
--- a/doc/quickref.xml
+++ b/doc/quickref.xml
@@ -139,7 +139,10 @@
buffers_adapter
consuming_buffers
dynabuf_readstream
+ errc
+ error_category
error_code
+ error_condition
handler_alloc
prepared_buffers
static_streambuf
diff --git a/examples/http_crawl.cpp b/examples/http_crawl.cpp
index 9948851f..3786ca00 100644
--- a/examples/http_crawl.cpp
+++ b/examples/http_crawl.cpp
@@ -49,7 +49,7 @@ int main(int, char const*[])
beast::http::read(sock, sb, res);
std::cout << res;
}
- catch(boost::system::system_error const& ec)
+ catch(beast::system_error const& ec)
{
std::cerr << host << ": " << ec.what();
}
diff --git a/extras/beast/test/fail_counter.hpp b/extras/beast/test/fail_counter.hpp
index b58e1f12..aaaa7a16 100644
--- a/extras/beast/test/fail_counter.hpp
+++ b/extras/beast/test/fail_counter.hpp
@@ -13,11 +13,9 @@
namespace beast {
namespace test {
-enum error
+enum class error
{
- success = 0,
-
- fail_error
+ fail_error = 1
};
namespace detail {
@@ -79,14 +77,15 @@ inline
error_code
make_error_code(error ev)
{
- return error_code{static_cast(ev),
- detail::get_error_category()};
+ return error_code{
+ static_cast::type>(ev),
+ detail::get_error_category()};
}
/** A countdown to simulated failure.
On the Nth operation, the class will fail with the specified
- error code, or the default error code of @ref fail_error.
+ error code, or the default error code of @ref error::fail_error.
*/
class fail_counter
{
@@ -102,7 +101,7 @@ public:
*/
explicit
fail_counter(std::size_t n,
- error_code ev = make_error_code(fail_error))
+ error_code ev = make_error_code(error::fail_error))
: n_(n)
, ec_(ev)
{
diff --git a/include/beast/core/async_completion.hpp b/include/beast/core/async_completion.hpp
index dc39d5ca..dd41e76e 100644
--- a/include/beast/core/async_completion.hpp
+++ b/include/beast/core/async_completion.hpp
@@ -34,11 +34,11 @@ namespace beast {
...
template
typename async_completion::result_type
+ void(error_code)>::result_type
async_initfn(..., CompletionHandler&& handler)
{
async_completion completion(handler);
+ void(error_code)> completion(handler);
...
return completion.result.get();
}
diff --git a/include/beast/core/detail/stream_concepts.hpp b/include/beast/core/detail/stream_concepts.hpp
index b71557f6..416ba878 100644
--- a/include/beast/core/detail/stream_concepts.hpp
+++ b/include/beast/core/detail/stream_concepts.hpp
@@ -9,6 +9,7 @@
#define BEAST_DETAIL_STREAM_CONCEPTS_HPP
#include
+#include
#include
#include
#include
@@ -22,7 +23,7 @@ namespace detail {
struct StreamHandler
{
StreamHandler(StreamHandler const&) = default;
- void operator()(boost::system::error_code ec, std::size_t);
+ void operator()(error_code ec, std::size_t);
};
using ReadHandler = StreamHandler;
using WriteHandler = StreamHandler;
@@ -79,9 +80,6 @@ public:
template
class is_SyncReadStream
{
- using error_code =
- boost::system::error_code;
-
template().read_some(
std::declval())),
@@ -108,9 +106,6 @@ public:
template
class is_SyncWriteStream
{
- using error_code =
- boost::system::error_code;
-
template().write_some(
std::declval())),
diff --git a/include/beast/core/error.hpp b/include/beast/core/error.hpp
index db7b65b4..d5dc92be 100644
--- a/include/beast/core/error.hpp
+++ b/include/beast/core/error.hpp
@@ -19,6 +19,18 @@ using error_code = boost::system::error_code;
/// The type of system error thrown by the library
using system_error = boost::system::system_error;
+/// The type of error category used by the library
+using error_category = boost::system::error_category;
+
+/// The type of error condition used by the library
+using error_condition = boost::system::error_condition;
+
+/// The set of constants used for cross-platform error codes
+#if GENERATING_DOCS
+enum errc{};
+#else
+namespace errc = boost::system::errc;
+#endif
} // beast
#endif
diff --git a/include/beast/http/impl/parse_error.ipp b/include/beast/http/impl/parse_error.ipp
new file mode 100644
index 00000000..7f2d9dc2
--- /dev/null
+++ b/include/beast/http/impl/parse_error.ipp
@@ -0,0 +1,107 @@
+//
+// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BEAST_HTTP_IMPL_PARSE_ERROR_IPP
+#define BEAST_HTTP_IMPL_PARSE_ERROR_IPP
+
+namespace boost {
+namespace system {
+template<>
+struct is_error_code_enum
+{
+ static bool const value = true;
+};
+} // system
+} // boost
+
+namespace beast {
+namespace http {
+namespace detail {
+
+class parse_error_category : public error_category
+{
+public:
+ const char*
+ name() const noexcept override
+ {
+ return "http";
+ }
+
+ std::string
+ message(int ev) const override
+ {
+ switch(static_cast(ev))
+ {
+ case parse_error::connection_closed: return "data after Connection close";
+ case parse_error::bad_method: return "bad method";
+ case parse_error::bad_uri: return "bad request-target";
+ case parse_error::bad_version: return "bad HTTP-Version";
+ case parse_error::bad_crlf: return "missing CRLF";
+ case parse_error::bad_status: return "bad status-code";
+ case parse_error::bad_reason: return "bad reason-phrase";
+ case parse_error::bad_field: return "bad field token";
+ case parse_error::bad_value: return "bad field-value";
+ case parse_error::bad_content_length: return "bad Content-Length";
+ case parse_error::illegal_content_length: return "illegal Content-Length with chunked Transfer-Encoding";
+ case parse_error::bad_on_headers_rv: return "on_headers returned an unknown value";
+ case parse_error::invalid_chunk_size: return "invalid chunk size";
+ case parse_error::invalid_ext_name: return "invalid ext name";
+ case parse_error::invalid_ext_val: return "invalid ext val";
+ case parse_error::headers_too_big: return "headers size limit exceeded";
+ case parse_error::body_too_big: return "body size limit exceeded";
+ case parse_error::short_read: return "unexpected end of data";
+ default:
+ return "parse error";
+ }
+ }
+
+ error_condition
+ default_error_condition(int ev) const noexcept override
+ {
+ return error_condition{ev, *this};
+ }
+
+ bool
+ equivalent(int ev,
+ error_condition const& condition
+ ) const noexcept override
+ {
+ return condition.value() == ev &&
+ &condition.category() == this;
+ }
+
+ bool
+ equivalent(error_code const& error, int ev) const noexcept override
+ {
+ return error.value() == ev &&
+ &error.category() == this;
+ }
+};
+
+inline
+error_category const&
+get_parse_error_category()
+{
+ static parse_error_category const cat{};
+ return cat;
+}
+
+} // detail
+
+inline
+error_code
+make_error_code(parse_error ev)
+{
+ return error_code{
+ static_cast::type>(ev),
+ detail::get_parse_error_category()};
+}
+
+} // http
+} // beast
+
+#endif
diff --git a/include/beast/http/impl/read.ipp b/include/beast/http/impl/read.ipp
index 4dab0461..06b81cf4 100644
--- a/include/beast/http/impl/read.ipp
+++ b/include/beast/http/impl/read.ipp
@@ -332,7 +332,7 @@ parse(SyncReadStream& stream,
error_code ec;
parse(stream, dynabuf, parser, ec);
if(ec)
- throw boost::system::system_error{ec};
+ throw system_error{ec};
}
template
diff --git a/include/beast/http/impl/write.ipp b/include/beast/http/impl/write.ipp
index 64f7a98d..2a319228 100644
--- a/include/beast/http/impl/write.ipp
+++ b/include/beast/http/impl/write.ipp
@@ -462,7 +462,7 @@ template const& msg,
- boost::system::error_code& ec)
+ error_code& ec)
{
static_assert(is_SyncWriteStream::value,
"SyncWriteStream requirements not met");
@@ -596,8 +596,8 @@ public:
buffer_size(buffer));
if(os_.fail())
{
- ec = boost::system::errc::make_error_code(
- boost::system::errc::no_stream_resources);
+ ec = errc::make_error_code(
+ errc::no_stream_resources);
break;
}
n += buffer_size(buffer);
diff --git a/include/beast/http/parse_error.hpp b/include/beast/http/parse_error.hpp
index b4d5c8d0..7463fbdb 100644
--- a/include/beast/http/parse_error.hpp
+++ b/include/beast/http/parse_error.hpp
@@ -15,15 +15,12 @@ namespace http {
enum class parse_error
{
- success = 0,
-
- connection_closed,
+ connection_closed = 1,
bad_method,
bad_uri,
bad_version,
bad_crlf,
- bad_request,
bad_status,
bad_reason,
@@ -45,132 +42,9 @@ enum class parse_error
general
};
-class parse_error_category : public boost::system::error_category
-{
-public:
- const char*
- name() const noexcept override
- {
- return "http";
- }
-
- std::string
- message(int ev) const override
- {
- switch(static_cast(ev))
- {
- case parse_error::connection_closed:
- return "data after Connection close";
-
- case parse_error::bad_method:
- return "bad method";
-
- case parse_error::bad_uri:
- return "bad request-target";
-
- case parse_error::bad_version:
- return "bad HTTP-Version";
-
- case parse_error::bad_crlf:
- return "missing CRLF";
-
- case parse_error::bad_request:
- return "bad reason-phrase";
-
- case parse_error::bad_status:
- return "bad status-code";
-
- case parse_error::bad_reason:
- return "bad reason-phrase";
-
- case parse_error::bad_field:
- return "bad field token";
-
- case parse_error::bad_value:
- return "bad field-value";
-
- case parse_error::bad_content_length:
- return "bad Content-Length";
-
- case parse_error::illegal_content_length:
- return "illegal Content-Length with chunked Transfer-Encoding";
-
- case parse_error::bad_on_headers_rv:
- return "on_headers returned an unknown value";
-
- case parse_error::invalid_chunk_size:
- return "invalid chunk size";
-
- case parse_error::invalid_ext_name:
- return "invalid ext name";
-
- case parse_error::invalid_ext_val:
- return "invalid ext val";
-
- case parse_error::headers_too_big:
- return "headers size limit exceeded";
-
- case parse_error::body_too_big:
- return "body size limit exceeded";
-
- case parse_error::short_read:
- return "unexpected end of data";
-
- default:
- return "parse error";
- }
- }
-
- boost::system::error_condition
- default_error_condition(int ev) const noexcept override
- {
- return boost::system::error_condition(ev, *this);
- }
-
- bool
- equivalent(int ev,
- boost::system::error_condition const& condition
- ) const noexcept override
- {
- return condition.value() == ev &&
- &condition.category() == this;
- }
-
- bool
- equivalent(error_code const& error, int ev) const noexcept override
- {
- return error.value() == ev &&
- &error.category() == this;
- }
-};
-
-inline
-boost::system::error_category const&
-get_parse_error_category()
-{
- static parse_error_category const cat{};
- return cat;
-}
-
-inline
-boost::system::error_code
-make_error_code(parse_error ev)
-{
- return error_code(static_cast(ev),
- get_parse_error_category());
-}
-
} // http
} // beast
-namespace boost {
-namespace system {
-template<>
-struct is_error_code_enum
-{
- static bool const value = true;
-};
-} // system
-} // boost
+#include
#endif
diff --git a/include/beast/http/read.hpp b/include/beast/http/read.hpp
index 7e5a0959..b38d31f7 100644
--- a/include/beast/http/read.hpp
+++ b/include/beast/http/read.hpp
@@ -44,7 +44,7 @@ namespace http {
@param parser An object meeting the requirements of Parser
which will receive the data.
- @throws boost::system::system_error on failure.
+ @throws system_error Thrown on failure.
*/
template
void
@@ -165,7 +165,7 @@ async_parse(AsyncReadStream& stream, DynamicBuffer& dynabuf,
@param msg An object used to store the message. Any
contents will be overwritten.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
template
diff --git a/include/beast/http/write.hpp b/include/beast/http/write.hpp
index 9a79f313..6d6b5917 100644
--- a/include/beast/http/write.hpp
+++ b/include/beast/http/write.hpp
@@ -40,7 +40,7 @@ namespace http {
@param msg The message to write.
- @throws boost::system::error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
template
diff --git a/include/beast/websocket/detail/error.hpp b/include/beast/websocket/detail/error.hpp
deleted file mode 100644
index 5aa1cf74..00000000
--- a/include/beast/websocket/detail/error.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BEAST_WEBSOCKET_DETAIL_ERROR_HPP
-#define BEAST_WEBSOCKET_DETAIL_ERROR_HPP
-
-#include
-
-namespace boost {
-namespace system {
-template<>
-struct is_error_code_enum
-{
- static bool const value = true;
-};
-} // system
-} // boost
-
-namespace beast {
-namespace websocket {
-namespace detail {
-
-class error_category : public boost::system::error_category
-{
-public:
- const char*
- name() const noexcept override
- {
- return "websocket";
- }
-
- std::string
- message(int ev) const override
- {
- switch(static_cast(ev))
- {
- case error::closed: return "WebSocket connection closed normally";
- case error::failed: return "WebSocket connection failed due to a protocol violation";
- case error::handshake_failed: return "WebSocket Upgrade handshake failed";
- case error::keep_alive: return "WebSocket Upgrade handshake failed but connection is still open";
-
- case error::response_malformed: return "malformed HTTP response";
- case error::response_failed: return "upgrade request failed";
- case error::response_denied: return "upgrade request denied";
- case error::request_malformed: return "malformed HTTP request";
- case error::request_invalid: return "upgrade request invalid";
- case error::request_denied: return "upgrade request denied";
- default:
- return "websocket error";
- }
- }
-
- boost::system::error_condition
- default_error_condition(int ev) const noexcept override
- {
- return boost::system::error_condition(ev, *this);
- }
-
- bool
- equivalent(int ev,
- boost::system::error_condition const& condition
- ) const noexcept override
- {
- return condition.value() == ev &&
- &condition.category() == this;
- }
-
- bool
- equivalent(error_code const& error, int ev) const noexcept override
- {
- return error.value() == ev &&
- &error.category() == this;
- }
-};
-
-inline
-boost::system::error_category const&
-get_error_category()
-{
- static detail::error_category const cat{};
- return cat;
-}
-
-} // detail
-} // websocket
-} // beast
-
-#endif
diff --git a/include/beast/websocket/error.hpp b/include/beast/websocket/error.hpp
index c86307cb..e259fee0 100644
--- a/include/beast/websocket/error.hpp
+++ b/include/beast/websocket/error.hpp
@@ -16,10 +16,8 @@ namespace websocket {
/// Error codes returned from @ref stream operations.
enum class error
{
- success = 0,
-
/// Both sides performed a WebSocket close
- closed,
+ closed = 1,
/// WebSocket connection failed, protocol violation
failed,
@@ -52,11 +50,6 @@ enum class error
general
};
-#if ! GENERATING_DOCS
-error_code
-make_error_code(error e);
-#endif
-
} // websocket
} // beast
diff --git a/include/beast/websocket/impl/error.ipp b/include/beast/websocket/impl/error.ipp
index b4c29102..19c497a4 100644
--- a/include/beast/websocket/impl/error.ipp
+++ b/include/beast/websocket/impl/error.ipp
@@ -5,20 +5,93 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
-#ifndef BEAST_WEBSOCKET_IMPL_ERROR_IPP_HPP
-#define BEAST_WEBSOCKET_IMPL_ERROR_IPP_HPP
+#ifndef BEAST_WEBSOCKET_IMPL_ERROR_IPP
+#define BEAST_WEBSOCKET_IMPL_ERROR_IPP
-#include
+namespace boost {
+namespace system {
+template<>
+struct is_error_code_enum
+{
+ static bool const value = true;
+};
+} // system
+} // boost
namespace beast {
namespace websocket {
+namespace detail {
+
+class websocket_error_category : public error_category
+{
+public:
+ const char*
+ name() const noexcept override
+ {
+ return "websocket";
+ }
+
+ std::string
+ message(int ev) const override
+ {
+ switch(static_cast(ev))
+ {
+ case error::closed: return "WebSocket connection closed normally";
+ case error::failed: return "WebSocket connection failed due to a protocol violation";
+ case error::handshake_failed: return "WebSocket Upgrade handshake failed";
+ case error::keep_alive: return "WebSocket Upgrade handshake failed but connection is still open";
+
+ case error::response_malformed: return "malformed HTTP response";
+ case error::response_failed: return "upgrade request failed";
+ case error::response_denied: return "upgrade request denied";
+ case error::request_malformed: return "malformed HTTP request";
+ case error::request_invalid: return "upgrade request invalid";
+ case error::request_denied: return "upgrade request denied";
+ default:
+ return "websocket error";
+ }
+ }
+
+ error_condition
+ default_error_condition(int ev) const noexcept override
+ {
+ return error_condition(ev, *this);
+ }
+
+ bool
+ equivalent(int ev,
+ error_condition const& condition
+ ) const noexcept override
+ {
+ return condition.value() == ev &&
+ &condition.category() == this;
+ }
+
+ bool
+ equivalent(error_code const& error, int ev) const noexcept override
+ {
+ return error.value() == ev &&
+ &error.category() == this;
+ }
+};
+
+inline
+error_category const&
+get_error_category()
+{
+ static detail::websocket_error_category const cat{};
+ return cat;
+}
+
+} // detail
inline
error_code
make_error_code(error e)
{
return error_code(
- static_cast(e), detail::get_error_category());
+ static_cast::type>(e),
+ detail::get_error_category());
}
} // websocket
diff --git a/include/beast/websocket/stream.hpp b/include/beast/websocket/stream.hpp
index d182aed9..f200621f 100644
--- a/include/beast/websocket/stream.hpp
+++ b/include/beast/websocket/stream.hpp
@@ -352,7 +352,7 @@ public:
HTTP response is sent indicating the reason and status code
(typically 400, "Bad Request"). This counts as a failure.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
void
accept();
@@ -462,7 +462,7 @@ public:
then to received WebSocket frames. The implementation will
copy the caller provided data before the function returns.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
template
void
@@ -585,7 +585,7 @@ public:
Ownership is not transferred, the implementation will not access
this object from other threads.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
// VFALCO TODO This should also take a DynamicBuffer with any leftover bytes.
template
@@ -700,7 +700,7 @@ public:
@param resource The requesting URI, which may not be empty,
required by the HTTP protocol.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
@par Example
@code
@@ -837,7 +837,7 @@ public:
@param cr The reason for the close.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
void
close(close_reason const& cr);
@@ -937,7 +937,7 @@ public:
@param payload The payload of the ping message, which may be empty.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
void
ping(ping_data const& payload);
@@ -1031,7 +1031,7 @@ public:
@param dynabuf A dynamic buffer to hold the message data after
any masking or decompression has been applied.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
template
void
@@ -1166,7 +1166,7 @@ public:
@param dynabuf A dynamic buffer to hold the message data after
any masking or decompression has been applied.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
template
void
@@ -1304,7 +1304,7 @@ public:
the memory locations pointed to by buffers remains valid
until the completion handler is called.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
@note This function always sends an entire message. To
send a message in fragments, use @ref write_frame.
@@ -1341,7 +1341,7 @@ public:
@param ec Set to indicate what error occurred, if any.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
@note This function always sends an entire message. To
send a message in fragments, use @ref write_frame.
@@ -1426,7 +1426,7 @@ public:
@param buffers One or more buffers containing the frame's
payload data.
- @throws boost::system::system_error Thrown on failure.
+ @throws system_error Thrown on failure.
*/
template
void
@@ -1500,7 +1500,7 @@ public:
Copies will be made of the handler as required. The equivalent
function signature of the handler must be:
@code void handler(
- boost::system::error_code const& error // result of operation
+ error_code const& error // result of operation
); @endcode
*/
template
diff --git a/test/core/dynabuf_readstream.cpp b/test/core/dynabuf_readstream.cpp
index 9f76551e..a2ff8bc5 100644
--- a/test/core/dynabuf_readstream.cpp
+++ b/test/core/dynabuf_readstream.cpp
@@ -59,7 +59,7 @@ public:
decltype(fs)&, streambuf> srs(fs);
srs.buffer().commit(buffer_copy(
srs.buffer().prepare(5), buffer("Hello", 5)));
- boost::system::error_code ec;
+ error_code ec;
boost::asio::read(srs, buffer(&s[0], s.size()), ec);
if(! ec)
{
@@ -78,7 +78,7 @@ public:
srs.capacity(3);
srs.buffer().commit(buffer_copy(
srs.buffer().prepare(5), buffer("Hello", 5)));
- boost::system::error_code ec;
+ error_code ec;
boost::asio::read(srs, buffer(&s[0], s.size()), ec);
if(! ec)
{
@@ -96,7 +96,7 @@ public:
decltype(fs)&, streambuf> srs(fs);
srs.buffer().commit(buffer_copy(
srs.buffer().prepare(5), buffer("Hello", 5)));
- boost::system::error_code ec;
+ error_code ec;
boost::asio::async_read(
srs, buffer(&s[0], s.size()), do_yield[ec]);
if(! ec)
@@ -116,7 +116,7 @@ public:
srs.capacity(3);
srs.buffer().commit(buffer_copy(
srs.buffer().prepare(5), buffer("Hello", 5)));
- boost::system::error_code ec;
+ error_code ec;
boost::asio::async_read(
srs, buffer(&s[0], s.size()), do_yield[ec]);
if(! ec)
diff --git a/test/http/basic_parser_v1.cpp b/test/http/basic_parser_v1.cpp
index 3b0144e1..be2f13da 100644
--- a/test/http/basic_parser_v1.cpp
+++ b/test/http/basic_parser_v1.cpp
@@ -209,19 +209,19 @@ public:
p.on_body_rv(onBodyRv);
error_code ec;
p.write(buffer(s1.data(), s1.size()), ec);
- if(ec == test::fail_error)
+ if(ec == test::error::fail_error)
continue;
if(! BEAST_EXPECT(! ec))
break;
if(! BEAST_EXPECT(s2.empty() || ! p.complete()))
break;
p.write(buffer(s2.data(), s2.size()), ec);
- if(ec == test::fail_error)
+ if(ec == test::error::fail_error)
continue;
if(! BEAST_EXPECT(! ec))
break;
p.write_eof(ec);
- if(ec == test::fail_error)
+ if(ec == test::error::fail_error)
continue;
if(! BEAST_EXPECT(! ec))
break;
@@ -257,7 +257,7 @@ public:
p.on_body_rv(onBodyRv);
error_code ec;
p.write(buffer(s1.data(), s1.size()), ec);
- if(ec == test::fail_error)
+ if(ec == test::error::fail_error)
continue;
if(ec)
{
@@ -269,7 +269,7 @@ public:
if(! s2.empty())
{
p.write(buffer(s2.data(), s2.size()), ec);
- if(ec == test::fail_error)
+ if(ec == test::error::fail_error)
continue;
if(ec)
{
@@ -280,7 +280,7 @@ public:
break;
}
p.write_eof(ec);
- if(ec == test::fail_error)
+ if(ec == test::error::fail_error)
continue;
BEAST_EXPECT(! p.complete());
BEAST_EXPECT((ec && ! ev) || ec == ev);
diff --git a/test/http/nodejs_parser.hpp b/test/http/nodejs_parser.hpp
index 19c09cd5..ecde20cb 100644
--- a/test/http/nodejs_parser.hpp
+++ b/test/http/nodejs_parser.hpp
@@ -174,7 +174,7 @@ public:
error_code ec;
auto const used = write(data, size, ec);
if(ec)
- throw boost::system::system_error{ec};
+ throw system_error{ec};
return used;
}
@@ -189,7 +189,7 @@ public:
error_code ec;
auto const used = write(buffers, ec);
if(ec)
- throw boost::system::system_error{ec};
+ throw system_error{ec};
return used;
}
@@ -204,7 +204,7 @@ public:
error_code ec;
write_eof(ec);
if(ec)
- throw boost::system::system_error{ec};
+ throw system_error{ec};
}
void
diff --git a/test/http/parse_error.cpp b/test/http/parse_error.cpp
index 769d09e6..a20e6f4f 100644
--- a/test/http/parse_error.cpp
+++ b/test/http/parse_error.cpp
@@ -23,11 +23,13 @@ public:
BEAST_EXPECT(std::string{ec.category().name()} == name);
BEAST_EXPECT(! ec.message().empty());
BEAST_EXPECT(std::addressof(ec.category()) ==
- std::addressof(get_parse_error_category()));
- BEAST_EXPECT(get_parse_error_category().equivalent(static_cast(ev),
- ec.category().default_error_condition(static_cast(ev))));
- BEAST_EXPECT(get_parse_error_category().equivalent(
- ec, static_cast(ev)));
+ std::addressof(detail::get_parse_error_category()));
+ BEAST_EXPECT(detail::get_parse_error_category().equivalent(
+ static_cast::type>(ev),
+ ec.category().default_error_condition(
+ static_cast::type>(ev))));
+ BEAST_EXPECT(detail::get_parse_error_category().equivalent(
+ ec, static_cast::type>(ev)));
}
void run() override
@@ -37,7 +39,6 @@ public:
check("http", parse_error::bad_uri);
check("http", parse_error::bad_version);
check("http", parse_error::bad_crlf);
- check("http", parse_error::bad_request);
check("http", parse_error::bad_status);
check("http", parse_error::bad_reason);
check("http", parse_error::bad_field);
diff --git a/test/websocket/error.cpp b/test/websocket/error.cpp
index 29a0210f..f7895fde 100644
--- a/test/websocket/error.cpp
+++ b/test/websocket/error.cpp
@@ -24,10 +24,12 @@ public:
BEAST_EXPECT(! ec.message().empty());
BEAST_EXPECT(std::addressof(ec.category()) ==
std::addressof(detail::get_error_category()));
- BEAST_EXPECT(detail::get_error_category().equivalent(static_cast(ev),
- ec.category().default_error_condition(static_cast(ev))));
BEAST_EXPECT(detail::get_error_category().equivalent(
- ec, static_cast(ev)));
+ static_cast::type>(ev),
+ ec.category().default_error_condition(
+ static_cast::type>(ev))));
+ BEAST_EXPECT(detail::get_error_category().equivalent(
+ ec, static_cast::type>(ev)));
}
void run() override
diff --git a/test/websocket/stream.cpp b/test/websocket/stream.cpp
index 775c3c06..618e54f0 100644
--- a/test/websocket/stream.cpp
+++ b/test/websocket/stream.cpp
@@ -816,7 +816,7 @@ public:
fail();
return false;
}
- catch(boost::system::system_error const& se)
+ catch(system_error const& se)
{
if(se.code() != ev)
throw;