code: def sentry_monitor(error_stream=None, **kwargs):
      
      def decorator(func):
          """A decorator that adds Sentry monitoring to a Lambda handler."""
          def wrapper(event, context):
              """Wrap the target function."""
              client = _setup_sentry_client(context)
              try:
                  return func(event, context)
              except (ProcessingError, OutOfOrderError) as err:
                  # A controlled exception from the Kinesis processor
                  _handle_processing_error(err, error_stream, client)
              except Exception as err:
                  # Raise the exception and block the stream processor
                  if client:
                      client.captureException()
                  raise
          return wrapper
  
      return decorator
docs: Sentry monitoring for AWS Lambda handler.