]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Throw a custom exception on unsupported operation
authorRaphael Michel <mail@raphaelmichel.de>
Thu, 29 Nov 2018 17:04:03 +0000 (18:04 +0100)
committerRaphael Michel <mail@raphaelmichel.de>
Mon, 3 Dec 2018 18:35:22 +0000 (19:35 +0100)
fints/client.py
fints/exceptions.py

index b90b836790a3639192ec07d7b975067ca3255a0f..cf0e9aa5f54549a2a4d96a7cc900742984c1f08d 100644 (file)
@@ -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
index c34c3ffc94c16fb9c5329916ef16543baa542670..ee9f2ee0a7d6b925e6fcf03f50e4814b3cea0e4e 100644 (file)
@@ -18,3 +18,7 @@ class FinTSDialogInitError(FinTSDialogError):
 
 class FinTSConnectionError(FinTSError):
     pass
+
+
+class FinTSUnsupportedOperation(FinTSError):
+    pass
\ No newline at end of file