Introduce error handling
This commit is contained in:
parent
5d9893d304
commit
32c1d2ab67
4 changed files with 54 additions and 7 deletions
15
src/main.rs
15
src/main.rs
|
@ -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 ;
|
||||
} ) ;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue