mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2026-01-11 16:36:15 +00:00
scmi: Improve output on backend configuration error
Print a properly formatted error to both the log and terminal. Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
This commit is contained in:
parent
0261d315ac
commit
07cbe73dc8
@ -107,8 +107,12 @@ impl TryFrom<ScmiArgs> for VuScmiConfig {
|
||||
fn start_backend(config: VuScmiConfig) -> Result<()> {
|
||||
loop {
|
||||
debug!("Starting backend");
|
||||
// TODO: Print a nice error message on backend configuration failure.
|
||||
let backend = Arc::new(RwLock::new(VuScmiBackend::new(&config).unwrap()));
|
||||
let backend_instance = VuScmiBackend::new(&config);
|
||||
if let Err(error) = backend_instance {
|
||||
return Err(error.to_string());
|
||||
}
|
||||
|
||||
let backend = Arc::new(RwLock::new(backend_instance.unwrap()));
|
||||
let listener = Listener::new(config.socket_path.clone(), true).unwrap();
|
||||
let mut daemon = VhostUserDaemon::new(
|
||||
"vhost-device-scmi".to_owned(),
|
||||
@ -163,6 +167,7 @@ fn main() {
|
||||
Ok(config) => {
|
||||
if let Err(error) = start_backend(config) {
|
||||
error!("{error}");
|
||||
println!("{error}");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user