def sentry_monitor(error_stream=None, **kwargs):
def decorator(func):<EOL><INDENT>"""<STR_LIT>"""<EOL>def wrapper(event, context):<EOL><INDENT>"""<STR_LIT>"""<EOL>client = _setup_sentry_client(context)<EOL>try:<EOL><INDENT>return func(event, context)<EOL><DEDENT>except (ProcessingError, OutOfOrderError) as err:<EOL><INDENT>_handle_processing_error(err, error_stream, client)<EOL><DEDENT>except Exception as err:<EOL><INDENT>if client:<EOL><INDENT>client.captureException()<EOL><DEDENT>raise<EOL><DEDENT><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Sentry monitoring for AWS Lambda handler.