notFound
mach::notFound
Creates a Not Found response.
Description
Section titled “Description”Creates a 404 Not Found response, optionally containing the specified value.
Syntax
Section titled “Syntax”// (1)template <typename T>[[nodiscard]] mach::Reply<T> notFound(T value);
// (2)[[nodiscard]] mach::Reply<std::string> notFound(const char* value);
// (3)template <typename T = void>[[nodiscard]] mach::Reply<T> notFound();Return Value
Section titled “Return Value”Overload (1)
Section titled “Overload (1)”A Not Found reply containing the specified value.
Overload (2)
Section titled “Overload (2)”A Not Found reply containing the specified string.
Overload (3)
Section titled “Overload (3)”A Not Found reply with no value.
Template Parameters
Section titled “Template Parameters”Overload (1)
Section titled “Overload (1)”| Parameter | Description |
|---|---|
T |
The type of the response body. |
Overload (3)
Section titled “Overload (3)”| Parameter | Description |
|---|---|
T |
The reply value type used to match the endpoint’s return type. Defaults to void. |
Parameters
Section titled “Parameters”Overload (1)
Section titled “Overload (1)”| Parameter | Description |
|---|---|
value |
The response body. |
Overload (2)
Section titled “Overload (2)”| Parameter | Description |
|---|---|
value |
The response body. |
Remarks
Section titled “Remarks”Overload (2) converts the specified value to a std::string.
Examples
Section titled “Examples”Overload (1)
Section titled “Overload (1)”return mach::notFound(error);Overload (2)
Section titled “Overload (2)”return mach::notFound("User not found.");Overload (3)
Section titled “Overload (3)”return mach::notFound();See Also
Section titled “See Also”| Name | Description |
|---|---|
Reply |
Represents the result of an HTTP endpoint. |
ControllerBase::notFound |
Creates a Not Found response from a controller. |