Class: OpenNebula::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/opennebula/error.rb

Overview

The Error Class represents a generic error in the OpenNebula library. It contains a readable representation of the error. Any function in the OpenNebula module will return an Error object in case of error.

Constant Summary collapse

ESUCCESS =
0x0000
EAUTHENTICATION =
0x0100
EAUTHORIZATION =
0x0200
ENO_EXISTS =
0x0400
EACTION =
0x0800
ERPC_API =
0x1000
EINTERNAL =
0x2000
EALLOCATE =
0x4000
ELOCKED =
0x8000
ENOTDEFINED =
0xF001
EXML_RPC_CALL =
0xF002
EGRPC_CALL =
0xF004
ETIMEOUT =
0xF008

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, errno = 0x1111) ⇒ Error

message Description of the error errno OpenNebula code error



43
44
45
46
# File 'lib/opennebula/error.rb', line 43

def initialize(message=nil, errno=0x1111)
    @errno   = errno
    @message = message
end

Instance Attribute Details

#errnoObject (readonly)

Returns the value of attribute errno.



38
39
40
# File 'lib/opennebula/error.rb', line 38

def errno
  @errno
end

#messageObject (readonly)

Returns the value of attribute message.



38
39
40
# File 'lib/opennebula/error.rb', line 38

def message
  @message
end

Instance Method Details

#is_egrpc_call?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/opennebula/error.rb', line 58

def is_egrpc_call?
    @errno == EGRPC_CALL
end

#is_exml_rpc_call?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/opennebula/error.rb', line 54

def is_exml_rpc_call?()
    @errno == EXML_RPC_CALL
end

#to_strObject Also known as: inspect



48
49
50
# File 'lib/opennebula/error.rb', line 48

def to_str()
    @message
end