Exception: GeoCerts::ExceptionWithResponse

Inherits:
Exception
  • Object
show all
Defined in:
lib/geo_certs/exceptions.rb

Overview

An exception that is raised which contains an HTTP response, and additionally, errors and warnings received from GeoCerts.

Direct Known Subclasses

AllowableExceptionWithResponse, BadRequest, ServerError, Unauthorized

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Exception

from

Constructor Details

- (ExceptionWithResponse) initialize(response = nil)

A new instance of ExceptionWithResponse



40
41
42
43
44
45
46
47
48
# File 'lib/geo_certs/exceptions.rb', line 40

def initialize(response = nil)
  if response.respond_to?(:response)
    self.response = response.response
  elsif response
    self.response = response
  end
  
  self.set_backtrace(response.backtrace) if response.respond_to?(:backtrace)
end

Instance Attribute Details

- (Object) response

Returns the value of attribute response



38
39
40
# File 'lib/geo_certs/exceptions.rb', line 38

def response
  @response
end

Instance Method Details

- (Object) errors



54
55
56
# File 'lib/geo_certs/exceptions.rb', line 54

def errors
  @errors ||= []
end

- (Object) http_code



50
51
52
# File 'lib/geo_certs/exceptions.rb', line 50

def http_code
  response && response.respond_to?(:code) ? response.code.to_i : nil
end

- (Object) parameters



62
63
64
# File 'lib/geo_certs/exceptions.rb', line 62

def parameters
  @parameters ||= {}
end

- (Object) parameters=(value)



66
67
68
# File 'lib/geo_certs/exceptions.rb', line 66

def parameters=(value)
  @parameters = value
end

- (Object) to_s

:nodoc:



87
88
89
# File 'lib/geo_certs/exceptions.rb', line 87

def to_s # :nodoc:
  "HTTP #{http_code}: A #{self.class.name} exception has occurred"
end

- (Object) warnings



58
59
60
# File 'lib/geo_certs/exceptions.rb', line 58

def warnings
  @warnings ||= []
end