Sha256: 2d9ec39b3ae6898a89cd2b6aad5e7cbd41da9a6d490ff4ec0ad589c4b05eec18

Contents?: true

Size: 584 Bytes

Versions: 4

Compression:

Stored size: 584 Bytes

Contents

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

    def initialize(call, value)
      @call, @value = call, value
    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

4 entries across 4 versions & 2 rubygems

Version Path
celluloid-0.11.0 lib/celluloid/responses.rb
kulesa-celluloid-0.10.2 lib/celluloid/responses.rb
celluloid-0.10.0 lib/celluloid/responses.rb
celluloid-0.9.1 lib/celluloid/responses.rb