Improve errors reporting
This commit is contained in:
@ -44,7 +44,14 @@ pub async fn create(client: LibVirtReq, req: web::Json<VMInfo>) -> HttpResult {
|
||||
|
||||
/// Get the list of domains
|
||||
pub async fn list_all(client: LibVirtReq) -> HttpResult {
|
||||
let list = client.get_full_domains_list().await?;
|
||||
let list = match client.get_full_domains_list().await {
|
||||
Err(e) => {
|
||||
log::error!("Failed to get the list of domains! {e}");
|
||||
return Ok(HttpResponse::InternalServerError()
|
||||
.json(format!("Failed to get the list of domains! {e}")));
|
||||
}
|
||||
Ok(l) => l,
|
||||
};
|
||||
let mut out = Vec::with_capacity(list.len());
|
||||
|
||||
for entry in list {
|
||||
|
Reference in New Issue
Block a user