Sha256: 6799af467e40f754e9a709b3756b42ca9cd466a4a4a1b75919463655b6152ce4

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

module Chillout
  class Dispatcher
    class SendCreationsFailed < StandardError
    end

    def initialize(filter, server_side)
      @filter      = filter
      @server_side = server_side
    end

    def dispatch_error(error)
      if @filter.deliver_error?(error)
        send_error(error)
      end
    end

    def send_error(error)
      @server_side.send_error(error)
    rescue HttpClient::NotSent
    end

    def send_creations(creations)
      @server_side.send_creations(creations)
    rescue HttpClient::NotSent
      raise SendCreationsFailed.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chillout-0.2.3 lib/chillout/dispatcher.rb