@@ -667,10 +667,15 @@ class Client {
667667 final SubmitTransactionResponse response =
668668 await _sdk.submitTransaction (transaction);
669669 if (! response.success) {
670- logger.e ('Transaction failed with result: ${response .resultXdr }' );
671- return false ;
670+ throw StellarBalanceException .fromOperationResult (
671+ response.extras? .resultCodes? .operationsResultCodes,
672+ response.resultXdr,
673+ );
672674 }
675+
673676 return true ;
677+ } on StellarBalanceException catch (_) {
678+ rethrow ;
674679 } catch (error) {
675680 throw Exception ('Transaction failed due to: ${error .toString ()}' );
676681 }
@@ -706,10 +711,14 @@ class Client {
706711 final SubmitTransactionResponse response =
707712 await _sdk.submitTransaction (transaction);
708713 if (! response.success) {
709- logger.e ('Transaction failed with result: ${response .resultXdr }' );
710- return false ;
714+ throw StellarBalanceException .fromOperationResult (
715+ response.extras? .resultCodes? .operationsResultCodes,
716+ response.resultXdr,
717+ );
711718 }
712719 return true ;
720+ } on StellarBalanceException catch (_) {
721+ rethrow ;
713722 } catch (error) {
714723 throw Exception ('Transaction failed due to: ${error .toString ()}' );
715724 }
@@ -755,10 +764,14 @@ class Client {
755764 final SubmitTransactionResponse response =
756765 await _sdk.submitTransaction (transaction);
757766 if (! response.success) {
758- logger.e ('Transaction failed with result: ${response .resultXdr }' );
759- return false ;
767+ throw StellarBalanceException .fromOperationResult (
768+ response.extras? .resultCodes? .operationsResultCodes,
769+ response.resultXdr,
770+ );
760771 }
761772 return true ;
773+ } on StellarBalanceException catch (_) {
774+ rethrow ;
762775 } catch (error) {
763776 throw Exception ('Transaction failed due to: ${error .toString ()}' );
764777 }
0 commit comments