Exception: SODA::Exception
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- SODA::Exception
- Defined in:
- lib/soda/exceptions.rb
Overview
This is the base exception class. Rescue it if you want to catch any exception that your request might raise You can get the status code by e.http_code, or see anything about the response via e.response. For example, the entire result body (which is probably an HTML error page) is e.response.
Direct Known Subclasses
ExceptionWithResponse, SSLCertificateNotVerified, ServerBrokeConnection
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
- #message ⇒ Object
-
#original_exception ⇒ Object
Returns the value of attribute original_exception.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #default_message ⇒ Object
- #http_body ⇒ Object
- #http_code ⇒ Object
- #http_headers ⇒ Object
-
#initialize(response = nil, initial_response_code = nil) ⇒ Exception
constructor
A new instance of Exception.
- #to_s ⇒ Object
Constructor Details
#initialize(response = nil, initial_response_code = nil) ⇒ Exception
Returns a new instance of Exception.
82 83 84 85 86 |
# File 'lib/soda/exceptions.rb', line 82 def initialize response = nil, initial_response_code = nil @response = response = nil @initial_response_code = initial_response_code end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
79 80 81 |
# File 'lib/soda/exceptions.rb', line 79 def data @data end |
#message ⇒ Object
109 110 111 |
# File 'lib/soda/exceptions.rb', line 109 def || end |
#original_exception ⇒ Object
Returns the value of attribute original_exception.
78 79 80 |
# File 'lib/soda/exceptions.rb', line 78 def original_exception @original_exception end |
#response ⇒ Object
Returns the value of attribute response.
77 78 79 |
# File 'lib/soda/exceptions.rb', line 77 def response @response end |
Instance Method Details
#default_message ⇒ Object
113 114 115 |
# File 'lib/soda/exceptions.rb', line 113 def self.class.name end |
#http_body ⇒ Object
101 102 103 |
# File 'lib/soda/exceptions.rb', line 101 def http_body @response.body if @response end |
#http_code ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/soda/exceptions.rb', line 88 def http_code # return integer for compatibility if @response @response.code.to_i else @initial_response_code end end |
#http_headers ⇒ Object
97 98 99 |
# File 'lib/soda/exceptions.rb', line 97 def http_headers @response.headers if @response end |
#to_s ⇒ Object
105 106 107 |
# File 'lib/soda/exceptions.rb', line 105 def to_s end |