| 287 | |
| 288 | @classmethod |
| 289 | def lambda_handler(cls, event, context): # pragma: no cover |
| 290 | handler = global_handler or cls() |
| 291 | exception_handler = handler.settings.EXCEPTION_HANDLER |
| 292 | try: |
| 293 | return handler.handler(event, context) |
| 294 | except Exception as ex: |
| 295 | exception_processed = cls._process_exception( |
| 296 | exception_handler=exception_handler, |
| 297 | event=event, |
| 298 | context=context, |
| 299 | exception=ex, |
| 300 | ) |
| 301 | if not exception_processed: |
| 302 | # Only re-raise exception if handler directed so. Allows handler to control if lambda has to retry |
| 303 | # an event execution in case of failure. |
| 304 | raise |
| 305 | |
| 306 | @classmethod |
| 307 | def _process_exception(cls, exception_handler, event, context, exception): |