Skip to content
Download

NotFoundException

mach::NotFoundException

Represents an HTTP 404 (Not Found) exception.

NotFoundException indicates that the requested resource could not be found. It is typically thrown when a requested entity or endpoint does not exist.

NotFoundException derives from HttpException.

Primary header:

#include <mach/exceptions/NotFoundException.hpp>

Convenience header:

#include <mach/exceptions.hpp>
class NotFoundException final : public HttpException {
public:
explicit NotFoundException(
std::string message = "The requested resource was not found."
);
};
Property Value
Code 404
Status Not Found

NotFoundException inherits the public member functions of HttpException.

The exception message defaults to "The requested resource was not found." when no message is provided.

throw mach::NotFoundException();
Name Description
HttpException Base class for Mach HTTP exceptions.
BadRequestException Represents an HTTP 400 Bad Request.
UnauthorizedException Represents an HTTP 401 Unauthorized.
ForbiddenException Represents an HTTP 403 Forbidden.
ConflictException Represents an HTTP 409 Conflict.