Exception: Tenable::ApiError
- Defined in:
- lib/tenable/error.rb
Overview
Raised for non-success HTTP responses from the Tenable API.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ String?
readonly
The response body.
-
#status_code ⇒ Integer?
readonly
The HTTP status code.
Instance Method Summary collapse
-
#initialize(msg = nil, status_code: nil, body: nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(msg = nil, status_code: nil, body: nil) ⇒ ApiError
Returns a new instance of ApiError.
27 28 29 30 31 32 33 |
# File 'lib/tenable/error.rb', line 27 def initialize(msg = nil, status_code: nil, body: nil) @status_code = status_code @body = body = msg || "API request failed with status #{status_code}" = "#{message}: #{body}" if body super() end |
Instance Attribute Details
#body ⇒ String? (readonly)
Returns the response body.
22 23 24 |
# File 'lib/tenable/error.rb', line 22 def body @body end |
#status_code ⇒ Integer? (readonly)
Returns the HTTP status code.
19 20 21 |
# File 'lib/tenable/error.rb', line 19 def status_code @status_code end |