pub(crate) fn translate_status_code(e: &ApiError) -> StatusCode {
    match e {
        ApiError::DaemonAbnormal(kind) | ApiError::MountFilesystem(kind) => match kind {
            DaemonErrorKind::NotReady => StatusCode::ServiceUnavailable,
            DaemonErrorKind::Unsupported => StatusCode::NotImplemented,
            DaemonErrorKind::UnexpectedEvent(_) => StatusCode::BadRequest,
            _ => StatusCode::InternalServerError,
        },
        ApiError::Metrics(MetricsErrorKind::Stats(IoStatsError::NoCounter)) => StatusCode::NotFound,
        _ => StatusCode::InternalServerError,
    }
}
/// Translate ApiError message to HTTP status code.
Translate ApiError message to HTTP status code.
Translate ApiError message to HTTP status code .
pub(crate) fn translate_status_code(e: &ApiError) -> StatusCode {
    match e {
        ApiError::DaemonAbnormal(kind) | ApiError::MountFilesystem(kind) => match kind {
            DaemonErrorKind::NotReady => StatusCode::ServiceUnavailable,
            DaemonErrorKind::Unsupported => StatusCode::NotImplemented,
            DaemonErrorKind::UnexpectedEvent(_) => StatusCode::BadRequest,
            _ => StatusCode::InternalServerError,
        },
        ApiError::Metrics(MetricsErrorKind::Stats(IoStatsError::NoCounter)) => StatusCode::NotFound,
        _ => StatusCode::InternalServerError,
    }
}
pub ( crate ) fn translate_status_code ( e : & ApiError ) -> StatusCode { match e { ApiError :: DaemonAbnormal ( kind ) | ApiError :: MountFilesystem ( kind ) => match kind { DaemonErrorKind :: NotReady => StatusCode :: ServiceUnavailable , DaemonErrorKind :: Unsupported => StatusCode :: NotImplemented , DaemonErrorKind :: UnexpectedEvent ( _ ) => StatusCode :: BadRequest , _ => StatusCode :: InternalServerError , } , ApiError :: Metrics ( MetricsErrorKind :: Stats ( IoStatsError :: NoCounter ) ) => StatusCode :: NotFound , _ => StatusCode :: InternalServerError , } }
Translate ApiError message to HTTP status code.
Translate ApiError message to HTTP status code .
e
&ApiError
e
&ApiError