Exception: HighLevel::Error
- Inherits:
-
StandardError
- Object
- StandardError
- HighLevel::Error
- Defined in:
- lib/high_level/errors.rb
Overview
Base class for every error the SDK raises. Carries the HTTP context of the failed request where one is available.
Direct Known Subclasses
BadRequestError, ConfigurationError, ForbiddenError, NetworkError, NotFoundError, RateLimitError, ServerError, UnauthorizedError, UnprocessableEntityError, Webhooks::InvalidSignatureError
Instance Attribute Summary collapse
-
#request_id ⇒ String?
readonly
The
x-request-idresponse header, when present. -
#response_body ⇒ Object?
readonly
The parsed response body, when available.
-
#status ⇒ Integer?
readonly
The HTTP status code, when the error came from a response.
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, response_body: nil, request_id: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message = nil, status: nil, response_body: nil, request_id: nil) ⇒ Error
Returns a new instance of Error.
21 22 23 24 25 26 |
# File 'lib/high_level/errors.rb', line 21 def initialize( = nil, status: nil, response_body: nil, request_id: nil) super() @status = status @response_body = response_body @request_id = request_id end |
Instance Attribute Details
#request_id ⇒ String? (readonly)
Returns the x-request-id response header, when present.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/high_level/errors.rb', line 14 class Error < StandardError attr_reader :status, :response_body, :request_id # @param message [String, nil] human-readable error message # @param status [Integer, nil] HTTP status code # @param response_body [Object, nil] parsed response body # @param request_id [String, nil] the +x-request-id+ header value def initialize( = nil, status: nil, response_body: nil, request_id: nil) super() @status = status @response_body = response_body @request_id = request_id end end |
#response_body ⇒ Object? (readonly)
Returns the parsed response body, when available.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/high_level/errors.rb', line 14 class Error < StandardError attr_reader :status, :response_body, :request_id # @param message [String, nil] human-readable error message # @param status [Integer, nil] HTTP status code # @param response_body [Object, nil] parsed response body # @param request_id [String, nil] the +x-request-id+ header value def initialize( = nil, status: nil, response_body: nil, request_id: nil) super() @status = status @response_body = response_body @request_id = request_id end end |
#status ⇒ Integer? (readonly)
Returns the HTTP status code, when the error came from a response.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/high_level/errors.rb', line 14 class Error < StandardError attr_reader :status, :response_body, :request_id # @param message [String, nil] human-readable error message # @param status [Integer, nil] HTTP status code # @param response_body [Object, nil] parsed response body # @param request_id [String, nil] the +x-request-id+ header value def initialize( = nil, status: nil, response_body: nil, request_id: nil) super() @status = status @response_body = response_body @request_id = request_id end end |