macro_rules! http_error {
($(#[$meta:meta])* $vis:vis $name:ident, $status:expr, $message:expr $(,)?) => { ... };
}Expand description
Defines a zero-sized [HttpError] type that renders as a static message.
ยงExamples
use http_kit::{http_error, StatusCode, HttpError};
http_error!(
/// Reported when a resource is missing.
pub NotFoundError,
StatusCode::NOT_FOUND,
"resource not found"
);
let err = NotFoundError::new();
assert_eq!(err.status(), Some(StatusCode::NOT_FOUND));
assert_eq!(err.to_string(), "resource not found");