added HttpRequest to MethodNotAllowedException and NotFoundException
parent
86848e01eb
commit
827bc8e667
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
class NotFoundException: public std::exception
|
||||
{
|
||||
public:
|
||||
NotFoundException() {}
|
||||
|
||||
NotFoundException(HttpRequest * request)
|
||||
:request(request) {};
|
||||
HttpRequest * request;
|
||||
};
|
||||
|
|
|
@ -21,10 +21,10 @@ const Route* RequestRouter::match(HttpRequest &request)
|
|||
}
|
||||
|
||||
if (urlMatch) {
|
||||
throw MethodNotAllowedException(allowedMethods);
|
||||
throw MethodNotAllowedException(&request, allowedMethods);
|
||||
}
|
||||
|
||||
throw NotFoundException();
|
||||
throw NotFoundException(&request);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue