added HttpRequest to MethodNotAllowedException and NotFoundException

feature/UrlUtils
Kenneth Barbour 2018-02-20 20:13:05 -05:00
parent 86848e01eb
commit 827bc8e667
3 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,8 @@
class MethodNotAllowedException: public std::exception
{
public:
MethodNotAllowedException(uint8_t allowed)
: methodsAllowed(allowed) {};
MethodNotAllowedException(HttpRequest * request, uint8_t allowed)
: request(request), methodsAllowed(allowed) {};
HttpRequest * request;
uint8_t methodsAllowed;
};

View File

@ -5,6 +5,7 @@
class NotFoundException: public std::exception
{
public:
NotFoundException() {}
NotFoundException(HttpRequest * request)
:request(request) {};
HttpRequest * request;
};

View File

@ -21,10 +21,10 @@ const Route* RequestRouter::match(HttpRequest &request)
}
if (urlMatch) {
throw MethodNotAllowedException(allowedMethods);
throw MethodNotAllowedException(&request, allowedMethods);
}
throw NotFoundException();
throw NotFoundException(&request);
}