Navigation Menu

Skip to content

Commit

Permalink
Raise error for unexpected routing
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 2, 2015
1 parent a47fe2f commit 1b16029
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/droonga/farm.rb
Expand Up @@ -22,6 +22,13 @@ module Droonga
class Farm
include Deferrable

class NoSlice < StandardError
def initialize(message, extra_informations={})
message = "#{message}: #{extra_informations.inspect}"
super(message)
end
end

def initialize(name, catalog, loop, options={})
@name = name
@catalog = catalog
Expand Down Expand Up @@ -82,6 +89,9 @@ def stop_immediately
end

def process(slice_name, message)
unless @slices.key?(slice_name)
raise NoSlice.new(slice_name, :message => message, :slices => @slices.keys)
end
@slices[slice_name].process(message)
end
end
Expand Down

0 comments on commit 1b16029

Please sign in to comment.