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



20
21
22
23
24
# File 'lib/aspera/rest/call_error.rb', line 20

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

Instance Method Details

#data ⇒ Object



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

def data
  @context[:data]
end

#request ⇒ Object



7
8
9
# File 'lib/aspera/rest/call_error.rb', line 7

def request
  @context[:request]
end

#response ⇒ Object



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

def response
  @context[:response]
end