Tidy up error types:

* Restructure header material
* Clean up namespace type injections
* Remove extraneous 'success' constants
This commit is contained in:
Vinnie Falco
2017-07-20 08:12:12 -07:00
parent f2a283ed10
commit 6b0b016b21
23 changed files with 260 additions and 292 deletions
+6 -6
View File
@@ -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);
+3 -3
View File
@@ -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
+7 -6
View File
@@ -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<int>(ev),
ec.category().default_error_condition(static_cast<int>(ev))));
BEAST_EXPECT(get_parse_error_category().equivalent(
ec, static_cast<int>(ev)));
std::addressof(detail::get_parse_error_category()));
BEAST_EXPECT(detail::get_parse_error_category().equivalent(
static_cast<std::underlying_type<parse_error>::type>(ev),
ec.category().default_error_condition(
static_cast<std::underlying_type<parse_error>::type>(ev))));
BEAST_EXPECT(detail::get_parse_error_category().equivalent(
ec, static_cast<std::underlying_type<parse_error>::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);