Introduce error handling

This commit is contained in:
Reinout Meliesie 2024-11-29 21:06:14 +01:00
parent 5d9893d304
commit 32c1d2ab67
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
4 changed files with 54 additions and 7 deletions

View file

@ -1,4 +1,5 @@
mod collection ;
mod error ;
mod persistence ;
mod ui ;
mod utility ;
@ -8,7 +9,7 @@ use {
libadwaita :: { * , prelude :: * } ,
} ;
use crate :: { persistence :: * , ui :: * } ;
use crate :: { error :: * , persistence :: * , ui :: * } ;
@ -25,10 +26,14 @@ fn on_activate ( app : & Application ) {
ui . show_window () ;
spawn_future_local ( async move {
let collection = spawn_blocking ( ||
read_collection_file () . unwrap ()
) . await . unwrap () ;
async_result_context ( async {
let collection = spawn_blocking ( || read_collection_file () )
. await ? ? ;
ui . render_collection (collection) ;
ui . render_collection (collection) ;
Ok (())
} , |_| () , |error| {
ui . close_window () ;
} ) . await ;
} ) ;
}