mithril_aggregator/http_server/routes/
mod.rs

1mod artifact_routes;
2mod certificate_routes;
3mod epoch_routes;
4mod middlewares;
5mod proof_routes;
6pub(crate) mod reply;
7mod root_routes;
8pub mod router;
9mod signatures_routes;
10mod signer_routes;
11mod statistics_routes;
12mod status;
13
14/// Match the given result and do an early return with an internal server error (500)
15/// if it was an Error. Else return the unwrapped value.
16#[macro_export]
17macro_rules! unwrap_to_internal_server_error {
18    ($code:expr, $logger:expr => $($warn_comment:tt)*) => {
19        match $code {
20            Ok(res) => res,
21            Err(err) => {
22                slog::warn!($logger, $($warn_comment)*; "error" => ?err);
23                return Ok($crate::http_server::routes::reply::server_error(
24                    err,
25                ));
26            }
27        }
28    };
29}
30
31pub(crate) fn http_server_child_logger(logger: &slog::Logger) -> slog::Logger {
32    use mithril_common::logging::LoggerExtensions;
33    logger.new_with_name("http_server")
34}