wip(inventory_agent): Refactoring for better error handling in progress
This commit is contained in:
@@ -9,8 +9,16 @@ mod hwinfo;
|
||||
async fn inventory() -> impl Responder {
|
||||
log::info!("Received inventory request");
|
||||
let host = PhysicalHost::gather();
|
||||
log::info!("Inventory data gathered successfully");
|
||||
actix_web::HttpResponse::Ok().json(host)
|
||||
match host {
|
||||
Ok(host) => {
|
||||
log::info!("Inventory data gathered successfully");
|
||||
actix_web::HttpResponse::Ok().json(host)
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("Inventory data gathering FAILED");
|
||||
actix_web::HttpResponse::InternalServerError().json(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
|
||||
Reference in New Issue
Block a user