File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,13 @@ fn try_main(opts: Opts) -> anyhow::Result<()> {
75
75
create_github_client ( opts. app_id . into ( ) , opts. private_key . into_bytes ( ) . into ( ) )
76
76
} ) ?;
77
77
78
- let ctx = runtime. block_on ( BorsContext :: new (
79
- CommandParser :: new ( opts. cmd_prefix ) ,
80
- Arc :: new ( db) ,
81
- Arc :: new ( client) ,
82
- ) ) ;
78
+ let ctx = runtime
79
+ . block_on ( BorsContext :: new (
80
+ CommandParser :: new ( opts. cmd_prefix ) ,
81
+ Arc :: new ( db) ,
82
+ Arc :: new ( client) ,
83
+ ) )
84
+ . context ( "Cannot initialize bors context" ) ?;
83
85
let ( repository_tx, global_tx, bors_process) = create_bors_process ( ctx) ;
84
86
85
87
let refresh_tx = global_tx. clone ( ) ;
Original file line number Diff line number Diff line change @@ -17,16 +17,16 @@ impl<Client: RepositoryClient> BorsContext<Client> {
17
17
parser : CommandParser ,
18
18
db : Arc < dyn DbClient > ,
19
19
global_client : Arc < dyn GlobalClient < Client > > ,
20
- ) -> Self {
20
+ ) -> anyhow :: Result < Self > {
21
21
// this unwrap is making me nervous, but if lhe repos loading
22
22
// fails we might as well restart the bot
23
- let repositories = global_client. load_repositories ( ) . await . unwrap ( ) ;
23
+ let repositories = global_client. load_repositories ( ) . await ? ;
24
24
let repositories = Arc :: new ( ArcSwap :: new ( Arc :: new ( repositories) ) ) ;
25
- Self {
25
+ Ok ( Self {
26
26
parser,
27
27
db,
28
28
global_client,
29
29
repositories,
30
- }
30
+ } )
31
31
}
32
32
}
Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ impl TestBorsState {
72
72
Arc :: clone ( & self . db ) as Arc < dyn DbClient > ,
73
73
Arc :: new ( self . default_client . clone ( ) ) ,
74
74
)
75
- . await ,
75
+ . await
76
+ . unwrap ( ) ,
76
77
) ;
77
78
match event {
78
79
BorsEvent :: Repository ( event) => {
You can’t perform that action at this time.
0 commit comments