File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ pub enum Error {
3333 "Unable to verify existence of CUSF mainchain service(s) at {0}: {1}"
3434 ) ]
3535 VerifyMainchainServices ( url:: Url , tonic:: Status ) ,
36+ #[ error( "failed to connect to CUSF mainchain enforcer at {0}" ) ]
37+ ConnectMainchain ( url:: Url , #[ source] tonic:: Status ) ,
3638 #[ error( "io error" ) ]
3739 Io ( #[ from] std:: io:: Error ) ,
3840 #[ error( "miner error" ) ]
@@ -210,11 +212,21 @@ impl App {
210212 . connect_lazy ( ) ;
211213 let ( cusf_mainchain, cusf_mainchain_wallet) = if runtime
212214 . block_on ( Self :: check_proto_support ( transport. clone ( ) ) )
213- . map_err ( |err| {
214- Error :: VerifyMainchainServices (
215+ . map_err ( |err| match err {
216+ status
217+ // Kind of crude, but I'm unable to match this on a std::io::Error...
218+ if status. code ( ) == tonic:: Code :: Unavailable
219+ && status. message ( ) . contains ( "tcp connect error" ) =>
220+ {
221+ Error :: ConnectMainchain (
222+ config. mainchain_grpc_address . clone ( ) ,
223+ status,
224+ )
225+ }
226+ _ => Error :: VerifyMainchainServices (
215227 config. mainchain_grpc_address . clone ( ) ,
216228 err,
217- )
229+ ) ,
218230 } ) ? {
219231 (
220232 mainchain:: ValidatorClient :: new ( transport. clone ( ) ) ,
You can’t perform that action at this time.
0 commit comments