diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-02-05 16:15:09 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-03-29 18:02:11 +0100 |
commit | a475bd0fede9a3008fb4ffbdac2aad0c0580a6ab (patch) | |
tree | dc73834e9ac34118342d6d742739b8fdc0b039d0 /talerbank/app/middleware.py | |
parent | c4a08b5e6eab366c8d7f3c6f2bf410bd3165a2d3 (diff) | |
download | bank-a475bd0fede9a3008fb4ffbdac2aad0c0580a6ab.tar.gz bank-a475bd0fede9a3008fb4ffbdac2aad0c0580a6ab.tar.bz2 bank-a475bd0fede9a3008fb4ffbdac2aad0c0580a6ab.zip |
Handling new exeption within the middleware.
Diffstat (limited to 'talerbank/app/middleware.py')
-rw-r--r-- | talerbank/app/middleware.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/talerbank/app/middleware.py b/talerbank/app/middleware.py index 214a21e..a5888e2 100644 --- a/talerbank/app/middleware.py +++ b/talerbank/app/middleware.py @@ -7,8 +7,10 @@ from .views import \ LoginFailed, RejectNoRightsException) from .schemas import \ (URLParameterMissing, URLParameterMalformed, - JSONFieldException) -from .amount import CurrencyMismatch, BadFormatAmount + JSONFieldException, UnknownCurrencyException) +from .amount import \ + (CurrencyMismatch, BadFormatAmount, + NumberTooBig, NegativeNumber) LOGGER = logging.getLogger() @@ -41,12 +43,15 @@ class ExceptionMiddleware: CurrencyMismatch: 11, BadFormatAmount: 11, LoginFailed: 12, - RejectNoRightsException: 13} - + RejectNoRightsException: 13, + UnknownCurrencyException: 14, + NumberTooBig: 1, + NegativeNumber: 0} # List of all the HTTP endpoint that are likely # to generate exceptions. self.apis = { + "/withdraw": 5400, "/reject": 5300, "/history": 5200, "/admin/add/incoming": 5100} @@ -58,7 +63,8 @@ class ExceptionMiddleware: "/profile": "profile", "/register": "index", "/public-accounts": "index", - "/pin/verify": "profile"} + "/pin/verify": "profile", + "/withdraw": "profile"} ## # This function is transparently invoked by Django when |