From: Raphael Michel Date: Thu, 29 Nov 2018 17:04:03 +0000 (+0100) Subject: Throw a custom exception on unsupported operation X-Git-Tag: v2.0.0~1^2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77a6a0546ec50c93a1d9fa5e18daa6e13f4bb611;p=thirdparty%2Fpython-fints.git Throw a custom exception on unsupported operation --- diff --git a/fints/client.py b/fints/client.py index b90b836..cf0e9aa 100644 --- a/fints/client.py +++ b/fints/client.py @@ -690,8 +690,7 @@ class FinTS3Client: if hiccxs.parameter.sum_amount_required and control_sum is None: raise ValueError("Control sum required.") if book_as_single and not hiccxs.parameter.single_booking_allowed: - # FIXME Only do a warning and fall-back to book_as_single=False? - raise ValueError("Single booking not allowed by bank.") + raise FinTSUnsupportedOperation("Single booking not allowed by bank.") if control_sum: seg.sum_amount.amount = control_sum @@ -756,8 +755,7 @@ class FinTS3Client: if hidxxs.parameter.sum_amount_required and control_sum is None: raise ValueError("Control sum required.") if book_as_single and not hidxxs.parameter.single_booking_allowed: - # FIXME Only do a warning and fall-back to book_as_single=False? - raise ValueError("Single booking not allowed by bank.") + raise FinTSUnsupportedOperation("Single booking not allowed by bank.") if control_sum: seg.sum_amount.amount = control_sum diff --git a/fints/exceptions.py b/fints/exceptions.py index c34c3ff..ee9f2ee 100644 --- a/fints/exceptions.py +++ b/fints/exceptions.py @@ -18,3 +18,7 @@ class FinTSDialogInitError(FinTSDialogError): class FinTSConnectionError(FinTSError): pass + + +class FinTSUnsupportedOperation(FinTSError): + pass \ No newline at end of file