Skip to content
Download

notFound

mach::notFound

Creates a Not Found response.

Creates a 404 Not Found response, optionally containing the specified value.

// (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();

A Not Found reply containing the specified value.

A Not Found reply containing the specified string.

A Not Found reply with no value.

Parameter Description
T The type of the response body.
Parameter Description
T The reply value type used to match the endpoint’s return type. Defaults to void.
Parameter Description
value The response body.
Parameter Description
value The response body.

Overload (2) converts the specified value to a std::string.

return mach::notFound(error);
return mach::notFound("User not found.");
return mach::notFound();
Name Description
Reply Represents the result of an HTTP endpoint.
ControllerBase::notFound Creates a Not Found response from a controller.