Exception: Safire::Errors::DiscoveryError
- Defined in:
- lib/safire/errors.rb
Overview
Raised when protocol 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).
-
#label ⇒ String
readonly
Protocol label used in the error message (e.g. 'SMART configuration', 'UDAP metadata').
-
#status ⇒ Integer?
readonly
HTTP status code returned by the server.
Instance Method Summary collapse
-
#initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') ⇒ DiscoveryError
constructor
A new instance of DiscoveryError.
Constructor Details
#initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') ⇒ DiscoveryError
Returns a new instance of DiscoveryError.
96 97 98 99 100 101 102 |
# File 'lib/safire/errors.rb', line 96 def initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') @endpoint = endpoint @status = status @error_description = error_description @label = label super() end |
Instance Attribute Details
#endpoint ⇒ String (readonly)
Returns the discovery endpoint URL that was requested.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/safire/errors.rb', line 93 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description, :label def initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') @endpoint = endpoint @status = status @error_description = error_description @label = label super() end private def msg = "Failed to discover #{@label} 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).
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/safire/errors.rb', line 93 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description, :label def initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') @endpoint = endpoint @status = status @error_description = error_description @label = label super() end private def msg = "Failed to discover #{@label} from #{@endpoint}" msg += " (HTTP #{@status})" if @status msg += ": #{@error_description}" if @error_description msg end end |
#label ⇒ String (readonly)
Returns protocol label used in the error message (e.g. 'SMART configuration', 'UDAP metadata').
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/safire/errors.rb', line 93 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description, :label def initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') @endpoint = endpoint @status = status @error_description = error_description @label = label super() end private def msg = "Failed to discover #{@label} 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.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/safire/errors.rb', line 93 class DiscoveryError < Error attr_reader :endpoint, :status, :error_description, :label def initialize(endpoint:, status: nil, error_description: nil, label: 'SMART configuration') @endpoint = endpoint @status = status @error_description = error_description @label = label super() end private def msg = "Failed to discover #{@label} from #{@endpoint}" msg += " (HTTP #{@status})" if @status msg += ": #{@error_description}" if @error_description msg end end |