| 237 | |
| 238 | @classmethod |
| 239 | def lambda_handler(cls, event, context): # pragma: no cover |
| 240 | handler = cls() |
| 241 | exception_handler = handler.settings.EXCEPTION_HANDLER |
| 242 | try: |
| 243 | return handler.handler(event, context) |
| 244 | except Exception as ex: |
| 245 | exception_processed = cls._process_exception(exception_handler=exception_handler, |
| 246 | event=event, context=context, exception=ex) |
| 247 | if not exception_processed: |
| 248 | # Only re-raise exception if handler directed so. Allows handler to control if lambda has to retry |
| 249 | # an event execution in case of failure. |
| 250 | raise |
| 251 | |
| 252 | @classmethod |
| 253 | def _process_exception(cls, exception_handler, event, context, exception): |