Exception: Aspera::Rest::CallError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aspera/rest/call_error.rb

Overview

raised on error after REST call

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ CallError

Returns a new instance of CallError.

Parameters:

  • context (Hash, String) —

    with keys :messages, :request, :response, :data



23
24
25
26
27
# File 'lib/aspera/rest/call_error.rb', line 23

def initialize(context)
  context = {messages: [context]} if context.is_a?(String)
  @context = context
  super(@context[:messages].join("\n"))
end

Instance Method Details

#data ⇒ Object



18
19
20
# File 'lib/aspera/rest/call_error.rb', line 18

def data
  @context[:data]
end

#request ⇒ Object



10
11
12
# File 'lib/aspera/rest/call_error.rb', line 10

def request
  @context[:request]
end

#response ⇒ Object



14
15
16
# File 'lib/aspera/rest/call_error.rb', line 14

def response
  @context[:response]
end