Exception: RubyTCC::Error
- Inherits:
-
StandardError
- Object
- StandardError
- RubyTCC::Error
- Defined in:
- lib/rubytcc/error.rb
Overview
Custom error class for rescuing from all RubyTCC errors
Constant Summary collapse
- ConfigurationError =
Class.new(::ArgumentError)
- ClientError =
Raised when RubyTCC returns a 4xx HTTP status code
Class.new(self)
- RequestTimeout =
Raised when RubyTCC returns the HTTP status code 408
Class.new(ClientError)
- ResultError =
Raised when the result is not “Success”
Class.new(self)
Instance Attribute Summary collapse
- #code ⇒ Integer readonly
Class Method Summary collapse
-
.from_response(response) ⇒ RubyTCC::Error
Create a new error from an HTTP response.
Instance Method Summary collapse
-
#initialize(message = '', code = nil) ⇒ RubyTCC::Error
constructor
Initializes a new Error object.
Constructor Details
#initialize(message = '', code = nil) ⇒ RubyTCC::Error
Initializes a new Error object
44 45 46 47 |
# File 'lib/rubytcc/error.rb', line 44 def initialize( = '', code = nil) super() @code = code end |
Instance Attribute Details
#code ⇒ Integer (readonly)
5 6 7 |
# File 'lib/rubytcc/error.rb', line 5 def code @code end |
Class Method Details
.from_response(response) ⇒ RubyTCC::Error
Create a new error from an HTTP response
12 13 14 15 |
# File 'lib/rubytcc/error.rb', line 12 def from_response(response) , code = parse_error(response.body) new(, response.response_headers, code) end |