Exception: Safire::Errors::DiscoveryError

Inherits:
Error
  • Object
show all
Defined in:
lib/safire/errors.rb

Overview

Raised when SMART configuration discovery fails.

Instance Attribute Summary collapse

Instance Method Summary collapse

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(build_message)
end

Instance Attribute Details

#endpointString (readonly)

Returns the discovery endpoint URL that was requested.

Returns:

  • (String)

    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(build_message)
  end

  private

  def build_message
    msg = "Failed to discover SMART configuration from #{@endpoint}"
    msg += " (HTTP #{@status})" if @status
    msg += ": #{@error_description}" if @error_description
    msg
  end
end

#error_descriptionString? (readonly)

Returns description of why discovery failed (e.g. unexpected response format).

Returns:

  • (String, nil)

    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(build_message)
  end

  private

  def build_message
    msg = "Failed to discover SMART configuration from #{@endpoint}"
    msg += " (HTTP #{@status})" if @status
    msg += ": #{@error_description}" if @error_description
    msg
  end
end

#statusInteger? (readonly)

Returns HTTP status code returned by the server.

Returns:

  • (Integer, nil)

    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(build_message)
  end

  private

  def build_message
    msg = "Failed to discover SMART configuration from #{@endpoint}"
    msg += " (HTTP #{@status})" if @status
    msg += ": #{@error_description}" if @error_description
    msg
  end
end