Skip to content
Download

ForbiddenException

mach::ForbiddenException

Represents an HTTP 403 (Forbidden) exception.

ForbiddenException indicates that a request was understood, but the client does not have permission to perform the requested operation. It is typically thrown when authorization fails or access to a resource is denied.

ForbiddenException derives from HttpException.

Primary header:

#include <mach/exceptions/ForbiddenException.hpp>

Convenience header:

#include <mach/exceptions.hpp>
class ForbiddenException final : public HttpException {
public:
explicit ForbiddenException(
std::string message = "You do not have permission to access this resource."
);
};
Property Value
Code 403
Status Forbidden

ForbiddenException inherits the public member functions of HttpException.

The exception message defaults to "You do not have permission to access this resource." when no message is provided.

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