Exception: Libvirt::Errors::LibError
- Defined in:
- lib/libvirt/errors.rb
Constant Summary collapse
- ERROR_FIELDS =
Object contains detailed error information retrieved from libvirt.
[:code, :domain, :message, :level].freeze
Instance Attribute Summary collapse
-
#client_message ⇒ Object
readonly
Returns the value of attribute client_message.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#error_data ⇒ Object
readonly
Returns the value of attribute error_data.
-
#error_domain ⇒ Object
readonly
Returns the value of attribute error_domain.
-
#error_level ⇒ Object
readonly
Returns the value of attribute error_level.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
Instance Method Summary collapse
-
#initialize(client_message = nil) ⇒ LibError
constructor
When client_message ommited and virGetLastError return error message will be following: “ERROR_LEVEL: ERROR_NUMBER (ERROR_DOMAIN) ERROR_MESSAGE”.
Constructor Details
#initialize(client_message = nil) ⇒ LibError
When client_message ommited and virGetLastError return error message will be following: “ERROR_LEVEL: ERROR_NUMBER (ERROR_DOMAIN) ERROR_MESSAGE”. When client message provided and virGetLastError return error message will be following: “CLIENT_MESSAGEnERROR_LEVEL: ERROR_NUMBER (ERROR_DOMAIN) ERROR_MESSAGE”. When client message is provided and virGetLastError return no error message will be following: “CLIENT_MESSAGE”.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/libvirt/errors.rb', line 28 def initialize( = nil) @client_message = ptr = FFI::Error.virGetLastError unless ptr.null? struct = FFI::Error::Struct.new(ptr) @error_data = struct.members.map { |m| [m, struct[m]] }.to_h @error_code = error_data[:code] @error_domain = error_data[:domain] @error_message = error_data[:message] @error_level = error_data[:level] end super() end |
Instance Attribute Details
#client_message ⇒ Object (readonly)
Returns the value of attribute client_message.
14 15 16 |
# File 'lib/libvirt/errors.rb', line 14 def @client_message end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
14 15 16 |
# File 'lib/libvirt/errors.rb', line 14 def error_code @error_code end |
#error_data ⇒ Object (readonly)
Returns the value of attribute error_data.
14 15 16 |
# File 'lib/libvirt/errors.rb', line 14 def error_data @error_data end |
#error_domain ⇒ Object (readonly)
Returns the value of attribute error_domain.
14 15 16 |
# File 'lib/libvirt/errors.rb', line 14 def error_domain @error_domain end |
#error_level ⇒ Object (readonly)
Returns the value of attribute error_level.
14 15 16 |
# File 'lib/libvirt/errors.rb', line 14 def error_level @error_level end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
14 15 16 |
# File 'lib/libvirt/errors.rb', line 14 def @error_message end |