Exception: Safire::Errors::DiscoveryError
- Defined in:
- lib/safire/errors.rb
Overview
Raised when SMART configuration discovery fails.
Instance Attribute Summary collapse
-
#endpoint ⇒ String
readonly
The discovery endpoint URL that was requested.
-
#error_description ⇒ String?
readonly
Description of why discovery failed (e.g. unexpected response format).
-
#status ⇒ Integer?
readonly
HTTP status code returned by the server.
Instance Method Summary collapse
-
#initialize(endpoint:, status: nil, error_description: nil) ⇒ DiscoveryError
constructor
A new instance of DiscoveryError.
Constructor Details
#initialize(endpoint:, status: nil, error_description: nil) ⇒ DiscoveryError
Returns a new instance of DiscoveryError.
86 87 88 89 90 91 |
# File 'lib/safire/errors.rb', line 86 def initialize(endpoint:, status: nil, error_description: nil) @endpoint = endpoint @status = status @error_description = error_description super() end |
Instance Attribute Details
#endpoint ⇒ String (readonly)
Returns the discovery endpoint URL that was requested.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/safire/errors.rb', line 83 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description def initialize(endpoint:, status: nil, error_description: nil) @endpoint = endpoint @status = status @error_description = error_description super() end private def msg = "Failed to discover SMART configuration from #{@endpoint}" msg += " (HTTP #{@status})" if @status msg += ": #{@error_description}" if @error_description msg end end |
#error_description ⇒ String? (readonly)
Returns description of why discovery failed (e.g. unexpected response format).
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/safire/errors.rb', line 83 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description def initialize(endpoint:, status: nil, error_description: nil) @endpoint = endpoint @status = status @error_description = error_description super() end private def msg = "Failed to discover SMART configuration from #{@endpoint}" msg += " (HTTP #{@status})" if @status msg += ": #{@error_description}" if @error_description msg end end |
#status ⇒ Integer? (readonly)
Returns HTTP status code returned by the server.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/safire/errors.rb', line 83 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description def initialize(endpoint:, status: nil, error_description: nil) @endpoint = endpoint @status = status @error_description = error_description super() end private def msg = "Failed to discover SMART configuration from #{@endpoint}" msg += " (HTTP #{@status})" if @status msg += ": #{@error_description}" if @error_description msg end end |