File tree Expand file tree Collapse file tree 15 files changed +92
-35
lines changed
testing/mjolnir/src/mjolnir_lib Expand file tree Collapse file tree 15 files changed +92
-35
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ impl TipUpdater {
93
93
while let Some ( block) = stream. next ( ) . await {
94
94
let block = block?;
95
95
let fragment_ids = block. fragments ( ) . map ( |f| f. id ( ) ) . collect ( ) ;
96
- self . try_request_fragment_removal ( fragment_ids, block. header ( ) ) ?;
96
+ self . try_request_fragment_removal ( fragment_ids, block. header ( ) ) . map_err ( |e| Error :: from ( * e ) ) ?;
97
97
}
98
98
99
99
self . blockchain
@@ -116,7 +116,7 @@ impl TipUpdater {
116
116
. put_tag ( MAIN_BRANCH_TAG , candidate_hash) ?;
117
117
118
118
let fragment_ids = block. fragments ( ) . map ( |f| f. id ( ) ) . collect ( ) ;
119
- self . try_request_fragment_removal ( fragment_ids, block. header ( ) ) ?;
119
+ self . try_request_fragment_removal ( fragment_ids, block. header ( ) ) . map_err ( |e| Error :: from ( * e ) ) ?;
120
120
121
121
self . tip . update_ref ( candidate) . await ;
122
122
Ok ( ( ) )
@@ -187,7 +187,7 @@ impl TipUpdater {
187
187
& mut self ,
188
188
fragment_ids : Vec < FragmentId > ,
189
189
header : & Header ,
190
- ) -> Result < ( ) , async_msg:: TrySendError < TransactionMsg > > {
190
+ ) -> Result < ( ) , Box < async_msg:: TrySendError < TransactionMsg > > > {
191
191
if let Some ( ref mut mbox) = self . fragment_mbox {
192
192
let hash = header. hash ( ) . into ( ) ;
193
193
let date = header. block_date ( ) ;
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ pub async fn post_message(
164
164
fail_fast : true ,
165
165
reply_handle,
166
166
} ;
167
- context. try_full ( ) ?. transaction_task . clone ( ) . try_send ( msg) ?;
167
+ context. try_full ( ) ?. transaction_task . clone ( ) . try_send ( msg) . map_err ( |e| Error :: TxMsgSendError ( Box :: new ( e ) ) ) ?;
168
168
let reply = reply_future. await ?;
169
169
if reply. is_error ( ) {
170
170
Err ( Error :: Fragment ( reply) )
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ pub async fn post_fragments(
103
103
fail_fast : batch. fail_fast ,
104
104
reply_handle,
105
105
} ;
106
- msgbox. try_send ( msg) ?;
106
+ msgbox. try_send ( msg) . map_err ( |e| Error :: TxMsgSend ( Box :: new ( e ) ) ) ?;
107
107
let reply = reply_future. await ?;
108
108
if reply. is_error ( ) {
109
109
Err ( Error :: Fragments ( reply) )
Original file line number Diff line number Diff line change @@ -10,12 +10,11 @@ use std::path::PathBuf;
10
10
use thiserror:: Error ;
11
11
12
12
#[ derive( Error , Debug ) ]
13
- #[ allow( clippy:: large_enum_variant) ]
14
13
pub enum ClientLoadCommandError {
15
14
#[ error( "No scenario defined for run. Available: [duration,iteration]" ) ]
16
15
NoScenarioDefined ,
17
16
#[ error( "Client Error" ) ]
18
- ClientError ( #[ from] MjolnirError ) ,
17
+ ClientError ( #[ from] Box < MjolnirError > ) ,
19
18
}
20
19
21
20
#[ derive( Parser , Debug ) ]
@@ -61,7 +60,7 @@ impl ClientLoadCommand {
61
60
62
61
let config = self . build_config ( ) ;
63
62
64
- Ok ( PassiveBootstrapLoad :: new ( config) . exec ( scenario_type. unwrap ( ) ) ? )
63
+ PassiveBootstrapLoad :: new ( config) . exec ( scenario_type. unwrap ( ) ) . map_err ( |e| ClientLoadCommandError :: ClientError ( Box :: new ( e ) ) )
65
64
}
66
65
67
66
fn get_block0_hash ( & self ) -> Hash {
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ use jormungandr_automation::{
5
5
use thiserror:: Error ;
6
6
7
7
#[ derive( Error , Debug ) ]
8
- #[ allow( clippy:: large_enum_variant) ]
9
8
pub enum MjolnirError {
10
9
#[ error( "cannot query rest" ) ]
11
10
RestError ( #[ from] RestError ) ,
@@ -18,5 +17,5 @@ pub enum MjolnirError {
18
17
#[ error( "pace is too low ({0})" ) ]
19
18
PaceTooLow ( u64 ) ,
20
19
#[ error( "get block0 error" ) ]
21
- Block0Error ( #[ from] Block0Error ) ,
20
+ Block0Error ( #[ from] Box < Block0Error > ) ,
22
21
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ use thiserror::Error;
11
11
#[ derive( Error , Debug ) ]
12
12
pub enum ExplorerLoadCommandError {
13
13
#[ error( "Client Error" ) ]
14
- ClientError ( #[ from] MjolnirError ) ,
14
+ ClientError ( #[ from] Box < MjolnirError > ) ,
15
15
}
16
16
17
17
#[ derive( Parser , Debug ) ]
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ impl VotesOnly {
80
80
Some ( self . faucet_spending_counter . into ( ) ) ,
81
81
Discrimination :: from_testing_bool ( self . testing ) ,
82
82
) ;
83
- let block0 = get_block ( & self . block0_path ) ?;
83
+ let block0 = get_block ( & self . block0_path ) . map_err ( |e| MjolnirError :: Block0Error ( Box :: new ( e ) ) ) ?;
84
84
let vote_plans = block0. vote_plans ( ) ;
85
85
86
86
let remote_jormungandr = RemoteJormungandrBuilder :: new ( "node" . to_owned ( ) )
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ pub enum FragmentLoadCommand {
18
18
#[ derive( Error , Debug ) ]
19
19
pub enum FragmentLoadCommandError {
20
20
#[ error( "Client Error" ) ]
21
- ClientError ( #[ from] MjolnirError ) ,
21
+ ClientError ( #[ from] Box < MjolnirError > ) ,
22
22
}
23
23
24
24
impl FragmentLoadCommand {
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ impl VotesOnly {
80
80
Some ( self . faucet_spending_counter . into ( ) ) ,
81
81
Discrimination :: from_testing_bool ( self . testing ) ,
82
82
) ;
83
- let block0 = get_block ( & self . block0_path ) ?;
83
+ let block0 = get_block ( & self . block0_path ) . map_err ( |e| MjolnirError :: Block0Error ( Box :: new ( e ) ) ) ?;
84
84
let vote_plans = block0. vote_plans ( ) ;
85
85
86
86
let remote_jormungandr = RemoteJormungandrBuilder :: new ( "node" . to_owned ( ) )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ use thiserror::Error;
11
11
#[ derive( Error , Debug ) ]
12
12
pub enum RestLoadCommandError {
13
13
#[ error( "Client Error" ) ]
14
- ClientError ( #[ from] MjolnirError ) ,
14
+ ClientError ( #[ from] Box < MjolnirError > ) ,
15
15
}
16
16
17
17
#[ derive( Parser , Debug ) ]
You can’t perform that action at this time.
0 commit comments