Can define network filters

This commit is contained in:
2024-01-02 18:56:16 +01:00
parent 2b145ebeff
commit d4ef389852
11 changed files with 349 additions and 43 deletions

View File

@ -1,4 +1,5 @@
use crate::libvirt_client::LibVirtClient;
use actix_http::StatusCode;
use actix_web::body::BoxBody;
use actix_web::{web, HttpResponse};
use std::error::Error;
@ -32,8 +33,15 @@ impl Display for HttpErr {
}
impl actix_web::error::ResponseError for HttpErr {
fn status_code(&self) -> StatusCode {
match self {
HttpErr::Err(_) => StatusCode::INTERNAL_SERVER_ERROR,
HttpErr::HTTPResponse(r) => r.status(),
}
}
fn error_response(&self) -> HttpResponse<BoxBody> {
log::error!("Error while processing request! {}", self);
HttpResponse::InternalServerError().body("Failed to execute request!")
}
}