Sha256: 036a45906e9e156cfed603b318199db521d54a5ac1ad02ab10446cb91ecba2b6

Contents?: true

Size: 613 Bytes

Versions: 2

Compression:

Stored size: 613 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.class.new(super.cause.message)
      else
        raise super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celluloid-0.9.0 lib/celluloid/responses.rb
celluloid-0.8.0 lib/celluloid/responses.rb