Skip to content
Download

BadRequestException

mach::BadRequestException

Represents an HTTP 400 (Bad Request) exception.

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.

Primary header:

#include <mach/exceptions/BadRequestException.hpp>

Convenience header:

#include <mach/exceptions.hpp>
class BadRequestException final : public HttpException {
public:
explicit BadRequestException(
std::string message = "The request was invalid."
);
};
Property Value
Code 400
Status Bad Request

BadRequestException inherits the public member functions of HttpException.

The exception message defaults to "The request was invalid." when no message is provided.

throw mach::BadRequestException("The request contains invalid data.");
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.