Skip to content

Commit 93098ae

Browse files
committed
invalid_url is now a base class of std::invalid_argument, instead of std::system_error.
1 parent e639f47 commit 93098ae

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

http/src/http/v2/client/client_errors.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ namespace network {
3535

3636
std::string client_category_impl::message(int ev) const {
3737
switch (client_error(ev)) {
38-
case client_error::invalid_url:
39-
return "Requires HTTP or HTTPS URL.";
38+
4039
case client_error::invalid_request:
4140
return "Invalid HTTP request.";
4241
case client_error::host_not_found:
@@ -59,7 +58,7 @@ namespace network {
5958
}
6059

6160
invalid_url::invalid_url()
62-
: std::system_error(make_error_code(client_error::invalid_url)) {
61+
: std::invalid_argument("Requires HTTP or HTTPS URL.") {
6362

6463
}
6564

http/src/network/http/v2/client/client_errors.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
* clients.
1313
*/
1414

15-
#include <network/config.hpp>
1615
#include <system_error>
16+
#include <stdexcept>
17+
#include <network/config.hpp>
1718

1819
namespace network {
1920
namespace http {
@@ -24,9 +25,6 @@ namespace network {
2425
* \brief An enumeration of all types of client error.
2526
*/
2627
enum class client_error {
27-
// url
28-
invalid_url,
29-
3028
// request
3129
invalid_request,
3230

@@ -52,7 +50,7 @@ namespace network {
5250
* \class invalid_url network/http/v2/client/client_errors.hpp network/http/v2/client.hpp
5351
* \brief An exception thrown if the URL provides is invalid.
5452
*/
55-
class invalid_url : public std::system_error {
53+
class invalid_url : public std::invalid_argument {
5654

5755
public:
5856

0 commit comments

Comments
 (0)