Exception: ActiveLrs::HttpError
- Defined in:
- lib/active_lrs/error.rb
Overview
Raised when an HTTP request to the LRS fails (non-2xx response).
Provides access to the HTTP status code and response body.
Instance Attribute Summary collapse
-
#body ⇒ Object?
readonly
The response body returned by the LRS.
-
#status ⇒ Integer?
readonly
The HTTP status code of the failed request.
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, body: nil) ⇒ HttpError
constructor
Initializes a new HttpError.
Constructor Details
#initialize(message = nil, status: nil, body: nil) ⇒ HttpError
Initializes a new HttpError.
30 31 32 33 34 |
# File 'lib/active_lrs/error.rb', line 30 def initialize( = nil, status: nil, body: nil) super( || "HTTP request failed") @status = status @body = body end |
Instance Attribute Details
#body ⇒ Object? (readonly)
Returns The response body returned by the LRS.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/active_lrs/error.rb', line 22 class HttpError < Error attr_reader :status, :body # Initializes a new HttpError. # # @param message [String, nil] Error message # @param status [Integer, nil] HTTP status code # @param body [Object, nil] HTTP response body def initialize( = nil, status: nil, body: nil) super( || "HTTP request failed") @status = status @body = body end end |
#status ⇒ Integer? (readonly)
Returns The HTTP status code of the failed request.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/active_lrs/error.rb', line 22 class HttpError < Error attr_reader :status, :body # Initializes a new HttpError. # # @param message [String, nil] Error message # @param status [Integer, nil] HTTP status code # @param body [Object, nil] HTTP response body def initialize( = nil, status: nil, body: nil) super( || "HTTP request failed") @status = status @body = body end end |