diff options
-rw-r--r-- | talerbank/app/middleware.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/talerbank/app/middleware.py b/talerbank/app/middleware.py index 53e05be..6bd129d 100644 --- a/talerbank/app/middleware.py +++ b/talerbank/app/middleware.py @@ -12,8 +12,16 @@ from .amount import CurrencyMismatch, BadFormatAmount LOGGER = logging.getLogger() + +## +# Class holding data needed by the handling logic. class ExceptionMiddleware: + ## + # Init constructor. + # + # @param self the object itself. + # @param get_response FIXME TBD. def __init__(self, get_response): self.get_response = get_response @@ -45,6 +53,15 @@ class ExceptionMiddleware: def __call__(self, request): return self.get_response(request) + + ## + # Main logic for processing the exception. It checks + # if the exception captured can be managed, and does it + # if so. Otherwise, it lets the native handler operate. + # + # @param a @a ExceptionMiddleware object. + # @param request Django-specific HTTP request. + # @param exception the exception raised from the bank. def process_exception(self, request, exception): # See if we manage this exception. Return None if not. exc_class = None |