# File lib/rfilter/delivery_agent.rb, line 288
      def process(input, logfile)
        begin
          lda = RFilter::DeliveryAgent.new(input, logfile)
          yield lda
          lda.defer("finished without a final delivery")
        rescue Exception => exception
          if exception.class <= DeliveryComplete
            raise exception
          else
            begin
              lda.log(0, "uncaught exception: " + exception.inspect)
              lda.log(0, "uncaught exception backtrace:\n    " +
                      exception.backtrace.join("\n    "))
              lda.defer("uncaught exception")
            rescue Exception
              if $!.class <= DeliveryComplete
                # The lda.defer above will generate this, just re-raise
                # the delivery status exception.
                raise
              else
                # Any errors logging in the uncaught exception and we
                # just re-raise the original exception
                raise exception
              end
            end
          end
        end
      end