Exception: SimpleCrowd::CrowdError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/simple_crowd/crowd_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original, message = nil) ⇒ CrowdError

Returns a new instance of CrowdError.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/simple_crowd/crowd_error.rb', line 7

def initialize(original, message=nil)
  @original = original

  if original.is_a?(Savon::SOAP::Fault)
    fault = original.to_hash[:fault] || {}
    @response = original.http
    @type = fault[:detail].keys.first rescue :fault
    message = fault[:faultstring] if message.blank?
  elsif original.is_a?(Savon::HTTP::Error)
    @response = original.http
    @type = :http
  end

  message = original.to_s if message.blank?
  super message
end

Instance Attribute Details

#originalObject (readonly)

Returns the value of attribute original.



5
6
7
# File 'lib/simple_crowd/crowd_error.rb', line 5

def original
  @original
end

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/simple_crowd/crowd_error.rb', line 3

def response
  @response
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/simple_crowd/crowd_error.rb', line 4

def type
  @type
end

Instance Method Details

#type?(type) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/simple_crowd/crowd_error.rb', line 24

def type? type
  @type == type.to_sym
end