Exception: BrocadeAPIClient::BrocadeException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/BrocadeAPIClient/exceptions.rb

Overview

Brocade Exception Classes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code: nil, message: nil, ref: nil, http_status: nil) ⇒ BrocadeException

Returns a new instance of BrocadeException.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/BrocadeAPIClient/exceptions.rb', line 15

def initialize(code: nil, message: nil, ref: nil, http_status: nil)
  @code = code
  @message = message
  @ref = ref
  @http_status = http_status
  formatted_string = 'Error: '
  formatted_string += format(' (HTTP %s)', @http_status) if @http_status
  formatted_string += format(' API code: %s', @code) if @code
  formatted_string += format(' - %s', @message) if @message
  formatted_string += format(' - %s', @ref) if @ref
  super(formatted_string)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



14
15
16
# File 'lib/BrocadeAPIClient/exceptions.rb', line 14

def code
  @code
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



14
15
16
# File 'lib/BrocadeAPIClient/exceptions.rb', line 14

def http_status
  @http_status
end

#messageObject (readonly)

Returns the value of attribute message.



14
15
16
# File 'lib/BrocadeAPIClient/exceptions.rb', line 14

def message
  @message
end

#refObject (readonly)

Returns the value of attribute ref.



14
15
16
# File 'lib/BrocadeAPIClient/exceptions.rb', line 14

def ref
  @ref
end