Sha256: 23bf9d71f81483979bac3da0ff96516f8120854bef0d4e3bf5e2ecbe3e4c8c06

Contents?: true

Size: 639 Bytes

Versions: 13

Compression:

Stored size: 639 Bytes

Contents

module Celluloid
  # Responses to calls
  class Response
    attr_reader :call, :value

    def initialize(call, value)
      @call, @value = call, value
    end

    def dispatch
      @call.task.resume self
    end
  end

  # Call completed successfully
  class SuccessResponse < Response; end

  # Call was aborted due to caller error
  class ErrorResponse < Response
    def value
      if super.is_a? AbortError
        # Aborts are caused by caller error, so ensure they capture the
        # caller's backtrace instead of the receiver's
        raise super.cause.exception
      else
        raise super
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
celluloid-0.12.4 lib/celluloid/responses.rb
celluloid-0.12.4.pre2 lib/celluloid/responses.rb
celluloid-0.12.4.pre lib/celluloid/responses.rb
celluloid-0.12.3 lib/celluloid/responses.rb
celluloid-0.12.2 lib/celluloid/responses.rb
celluloid-0.12.1 lib/celluloid/responses.rb
celluloid-0.12.1.pre2 lib/celluloid/responses.rb
celluloid-0.12.1.pre lib/celluloid/responses.rb
celluloid-0.12.0 lib/celluloid/responses.rb
celluloid-0.12.0.pre3 lib/celluloid/responses.rb
celluloid-0.12.0.pre2 lib/celluloid/responses.rb
celluloid-0.12.0.pre lib/celluloid/responses.rb
celluloid-0.11.1 lib/celluloid/responses.rb