ForbiddenException
mach::ForbiddenException
Represents an HTTP 403 (Forbidden) exception.
Description
Section titled “Description”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.
Headers
Section titled “Headers”Primary header:
#include <mach/exceptions/ForbiddenException.hpp>Convenience header:
#include <mach/exceptions.hpp>Syntax
Section titled “Syntax”class ForbiddenException final : public HttpException {public: explicit ForbiddenException( std::string message = "You do not have permission to access this resource." );};HTTP Status
Section titled “HTTP Status”| Property | Value |
|---|---|
| Code | 403 |
| Status | Forbidden |
Member Functions
Section titled “Member Functions”ForbiddenException inherits the public member functions of HttpException.
Remarks
Section titled “Remarks”The exception message defaults to "You do not have permission to access this resource." when no message is provided.
Example
Section titled “Example”throw mach::ForbiddenException();See Also
Section titled “See Also”| 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. |