Skip to content

Commit 6826ba8

Browse files
committed
Remove needless exception
1 parent 75c852e commit 6826ba8

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/http_endpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ webserver::http_endpoint::http_endpoint
9292
}
9393

9494
if((parts[i].size() < 3) || (parts[i][0] != '{') || (parts[i][parts[i].size() - 1] != '}'))
95-
throw webserver::http_endpoint::bad_http_endpoint();
95+
throw std::invalid_argument("Bad URL format");
9696

9797
std::string::size_type bar = parts[i].find_first_of('|');
9898
this->url_pars.push_back(parts[i].substr(1, bar != string::npos ? bar - 1 : parts[i].size() - 2));

src/httpserver/http_endpoint.hpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <utility>
3030
#include <regex.h>
3131
#include <string>
32+
#include <stdexcept>
3233

3334
#include "webserver.hpp"
3435

@@ -38,33 +39,12 @@ namespace httpserver
3839
class webserver;
3940
class http_resource;
4041

41-
namespace details
42-
{
43-
44-
/**
45-
* Exception class throwed when a bad formatted http url is used
46-
**/
47-
48-
};
49-
5042
/**
5143
* Class representing an Http Endpoint. It is an abstraction used by the APIs.
5244
**/
5345
class webserver::http_endpoint
5446
{
5547
public:
56-
class bad_http_endpoint : public std::exception
57-
{
58-
/**
59-
* Method used to see error details
60-
* @return a const char* containing the error message
61-
**/
62-
virtual const char* what() const throw()
63-
{
64-
return "Bad url format!";
65-
}
66-
};
67-
6848
/**
6949
* Copy constructor. It is useful expecially to copy regex_t structure that contains dinamically allocated data.
7050
* @param h The http_endpoint to copy

0 commit comments

Comments
 (0)