BadRequestException
mach::BadRequestException
Represents an HTTP 400 (Bad Request) exception.
Description
Section titled “Description”BadRequestException indicates that a request could not be processed because it was invalid. It is typically thrown when a request is syntactically correct but contains invalid or inconsistent data.
BadRequestException derives from HttpException.
Headers
Section titled “Headers”Primary header:
#include <mach/exceptions/BadRequestException.hpp>Convenience header:
#include <mach/exceptions.hpp>Syntax
Section titled “Syntax”class BadRequestException final : public HttpException {public: explicit BadRequestException( std::string message = "The request was invalid." );};HTTP Status
Section titled “HTTP Status”| Property | Value |
|---|---|
| Code | 400 |
| Status | Bad Request |
Member Functions
Section titled “Member Functions”BadRequestException inherits the public member functions of HttpException.
Remarks
Section titled “Remarks”The exception message defaults to "The request was invalid." when no message is provided.
Example
Section titled “Example”throw mach::BadRequestException("The request contains invalid data.");See Also
Section titled “See Also”| Name | Description |
|---|---|
HttpException |
Base class for Mach HTTP exceptions. |
UnauthorizedException |
Represents an HTTP 401 Unauthorized. |
ForbiddenException |
Represents an HTTP 403 Forbidden. |
NotFoundException |
Represents an HTTP 404 Not Found. |
ConflictException |
Represents an HTTP 409 Conflict. |