Improve errors reporting
This commit is contained in:
parent
c7f7bfe67c
commit
f651c756b6
@ -35,9 +35,16 @@ pub async fn create(client: LibVirtReq, req: web::Json<NetworkInfo>) -> HttpResu
|
||||
|
||||
/// Get the list of networks
|
||||
pub async fn list(client: LibVirtReq) -> HttpResult {
|
||||
let networks = client
|
||||
.get_full_networks_list()
|
||||
.await?
|
||||
let networks = match client.get_full_networks_list().await {
|
||||
Err(e) => {
|
||||
log::error!("Failed to get the list of networks! {e}");
|
||||
return Ok(HttpResponse::InternalServerError()
|
||||
.json(format!("Failed to get the list of networks! {e}")));
|
||||
}
|
||||
Ok(l) => l,
|
||||
};
|
||||
|
||||
let networks = networks
|
||||
.into_iter()
|
||||
.map(|n| NetworkInfo::from_xml(n).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -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 {
|
||||
|
@ -51,7 +51,7 @@ export function AlertDialogProvider(p: PropsWithChildren): React.ReactElement {
|
||||
<DialogContent>
|
||||
<DialogContentText
|
||||
id="alert-dialog-description"
|
||||
style={{ whiteSpace: "pre" }}
|
||||
style={{ whiteSpace: "pre-line" }}
|
||||
>
|
||||
{message}
|
||||
</DialogContentText>
|
||||
|
Loading…
Reference in New Issue
Block a user