Navigation Menu

Skip to content

Commit

Permalink
Stop by error from nil message
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 15, 2015
1 parent 0bb2fa1 commit e7fa57b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/drndump/dump_client.rb
Expand Up @@ -22,6 +22,9 @@ class DumpClient
attr_reader :error_message
attr_writer :on_finish, :on_progress, :on_error

class NilMessage < StandardError
end

def initialize(params)
@host = params[:host]
@port = params[:port]
Expand Down Expand Up @@ -59,6 +62,11 @@ def run(options={}, &block)
client.subscribe(dump_message) do |message|
on_progress(message)
case message
when nil
error = NilMessage.new("nil message in dump")
on_error(error)
client.close
@error_message = error.to_s
when Droonga::Client::Error
on_error(message)
client.close
Expand Down

0 comments on commit e7fa57b

Please sign in to comment.