Commit 2793b9c 1 parent 98393a7 commit 2793b9c Copy full SHA for 2793b9c
File tree 2 files changed +21
-11
lines changed
2 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,18 @@ impl Wish {
149
149
}
150
150
}
151
151
152
+ pub fn raise_error ( & self , message : & str , detail : & str ) {
153
+ self . predicates_window . withdraw ( ) ;
154
+ rstk:: message_box ( )
155
+ . parent ( & self . window )
156
+ . icon ( IconImage :: Error )
157
+ . title ( "Unexpected Error" )
158
+ . message ( message)
159
+ . detail ( detail)
160
+ . show ( ) ;
161
+ rstk:: end_wish ( ) ;
162
+ }
163
+
152
164
fn build_predicates_window ( & mut self ) {
153
165
self . predicates_window . resizable ( false , false ) ;
154
166
self . predicates_window . background ( "#dedddd" ) ;
@@ -420,10 +432,6 @@ impl Frontend for Wish {
420
432
}
421
433
422
434
fn display ( & self ) {
423
- if self . input == "_exit_" {
424
- rstk:: end_wish ( ) ;
425
- }
426
-
427
435
let page_size = std:: cmp:: min ( self . page_size , self . predicates . len ( ) ) ;
428
436
let texts: Vec < String > = self
429
437
. predicates
Original file line number Diff line number Diff line change @@ -21,11 +21,6 @@ struct Args {
21
21
fn main ( ) {
22
22
let args = Args :: parse ( ) ;
23
23
24
- let clafrica_conf = ClafricaConfig :: from_file ( & args. config_file ) . unwrap_or_else ( |err| {
25
- eprintln ! ( "Problem parsing config file: {err}" ) ;
26
- process:: exit ( 1 ) ;
27
- } ) ;
28
-
29
24
let wish_conf = WishConfig :: from_file ( & args. config_file ) . unwrap_or_else ( |err| {
30
25
eprintln ! ( "Problem parsing config file: {err}" ) ;
31
26
process:: exit ( 1 ) ;
@@ -37,9 +32,16 @@ fn main() {
37
32
// We start the backend
38
33
{
39
34
let frontend = frontend. clone ( ) ;
35
+
40
36
thread:: spawn ( move || {
41
- if let Err ( e) = run ( clafrica_conf, frontend) {
42
- eprintln ! ( "Application error: {e}" ) ;
37
+ let clafrica_conf =
38
+ ClafricaConfig :: from_file ( & args. config_file ) . unwrap_or_else ( |err| {
39
+ frontend. raise_error ( "Problem parsing config file" , & err. to_string ( ) ) ;
40
+ process:: exit ( 1 ) ;
41
+ } ) ;
42
+
43
+ if let Err ( e) = run ( clafrica_conf, frontend. clone ( ) ) {
44
+ frontend. raise_error ( "Application error" , & e. to_string ( ) ) ;
43
45
process:: exit ( 1 ) ;
44
46
}
45
47
} ) ;
You can’t perform that action at this time.
0 commit comments