Exception: OneviewSDK::OneViewError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/oneview-sdk/exceptions.rb

Overview

Error class allowing storage of a data attribute

Constant Summary collapse

MESSAGE =
'(No message)'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = self.class::MESSAGE, data = nil) ⇒ OneViewError

Returns a new instance of OneViewError.


19
20
21
22
# File 'lib/oneview-sdk/exceptions.rb', line 19

def initialize(msg = self.class::MESSAGE, data = nil)
  @data = data
  super(msg)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data


16
17
18
# File 'lib/oneview-sdk/exceptions.rb', line 16

def data
  @data
end

Class Method Details

.raise!(msg = self::MESSAGE, data = nil) ⇒ Object

Shorthand method to raise an error.

Examples:

OneviewSDK::OneViewError.raise! 'Message', { data: 'stuff' }

27
28
29
# File 'lib/oneview-sdk/exceptions.rb', line 27

def self.raise!(msg = self::MESSAGE, data = nil)
  raise new(msg, data)
end