@@ -182,6 +182,9 @@ pub enum MutinyError {
182182 /// Failed to connect to a federation.
183183 #[ error( "Failed to connect to a federation." ) ]
184184 FederationConnectionFailed ,
185+ /// Fedimint transaction too large
186+ #[ error( "Error constructing fedimint transaction, try lowering the amount." ) ]
187+ FederationTxTooLarge ,
185188 #[ error( transparent) ]
186189 Other ( anyhow:: Error ) ,
187190}
@@ -270,6 +273,7 @@ impl PartialEq for MutinyError {
270273 ( Self :: TokenAlreadySpent , Self :: TokenAlreadySpent ) => true ,
271274 ( Self :: FederationRequired , Self :: FederationRequired ) => true ,
272275 ( Self :: FederationConnectionFailed , Self :: FederationConnectionFailed ) => true ,
276+ ( Self :: FederationTxTooLarge , Self :: FederationTxTooLarge ) => true ,
273277 ( Self :: Other ( e) , Self :: Other ( e2) ) => e. to_string ( ) == e2. to_string ( ) ,
274278 _ => false ,
275279 }
@@ -601,7 +605,13 @@ impl From<anyhow::Error> for MutinyError {
601605 match e. to_string ( ) . as_str ( ) {
602606 "Insufficient balance" => Self :: InsufficientBalance ,
603607 "MissingInvoiceAmount" => Self :: BadAmountError ,
604- _ => Self :: Other ( e) ,
608+ "Federation didn't return peg-out fees" => Self :: FederationConnectionFailed ,
609+ "The generated transaction would be rejected by the federation for being too large." => Self :: FederationTxTooLarge ,
610+ str => if str. starts_with ( "Address isn't compatible with the federation's network" ) {
611+ Self :: IncorrectNetwork
612+ } else {
613+ Self :: Other ( e)
614+ } ,
605615 }
606616 }
607617}
0 commit comments