Exception: RHapi::ConnectionError
- Inherits:
-
StandardError
- Object
- StandardError
- RHapi::ConnectionError
- Defined in:
- lib/r_hapi/r_hapi_exception.rb
Instance Attribute Summary collapse
-
#error_string ⇒ Object
readonly
Returns the value of attribute error_string.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error_string) ⇒ ConnectionError
constructor
A new instance of ConnectionError.
- #message ⇒ Object
Constructor Details
#initialize(error_string) ⇒ ConnectionError
Returns a new instance of ConnectionError.
5 6 7 |
# File 'lib/r_hapi/r_hapi_exception.rb', line 5 def initialize(error_string) @error_string = error_string end |
Instance Attribute Details
#error_string ⇒ Object (readonly)
Returns the value of attribute error_string.
3 4 5 |
# File 'lib/r_hapi/r_hapi_exception.rb', line 3 def error_string @error_string end |
Class Method Details
.raise_error(response) ⇒ Object
21 22 23 24 |
# File 'lib/r_hapi/r_hapi_exception.rb', line 21 def self.raise_error(response) exception = RHapi::ConnectionError.new(response) raise(exception, exception.) end |
Instance Method Details
#message ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/r_hapi/r_hapi_exception.rb', line 9 def if @error_string =~ /401/ "HubSopt returned a 401 error: #{error_string}" elsif @error_string =~ /404/ "HubSopt returned a 404 error: #{error_string}" elsif @error_string =~ /500/ "HubSopt returned a 500 error: #{error_string}" else @error_string end end |