Exception: NWRFC::NWError

Inherits:
Exception
  • Object
show all
Defined in:
lib/nwrfc/nwerror.rb

Direct Known Subclasses

NWABAPException

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ NWError

Instantiate Error object with a handle to an FFI::MemoryPointer to an NWRFCLib::RFCError object. The error object is analyzed so that when the caller intercepts it with Rescue, all the error details are available

Raises:



11
12
13
14
15
16
17
18
19
20
# File 'lib/nwrfc/nwerror.rb', line 11

def initialize(error)
  @code =    NWRFCLib::RFC_RC[error[:code]]
  # In the event that the called function raised an exception, we must create a more specific
  # error
  raise(NWABAPException, error[:key].get_str)  if @code == :RFC_ABAP_EXCEPTION
  @group =   NWRFCLib::RFC_ERROR_GROUP[error[:group]]
  @message = error[:message].get_str
  @type =    error[:abapMsgType].get_str
  @number =  error[:abapMsgNumber].get_str
end

Instance Attribute Details

#classObject (readonly)

Returns the value of attribute class.



5
6
7
# File 'lib/nwrfc/nwerror.rb', line 5

def class
  @class
end

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/nwrfc/nwerror.rb', line 5

def code
  @code
end

#groupObject (readonly)

Returns the value of attribute group.



5
6
7
# File 'lib/nwrfc/nwerror.rb', line 5

def group
  @group
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/nwrfc/nwerror.rb', line 5

def message
  @message
end

#numberObject (readonly)

Returns the value of attribute number.



5
6
7
# File 'lib/nwrfc/nwerror.rb', line 5

def number
  @number
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/nwrfc/nwerror.rb', line 5

def type
  @type
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/nwrfc/nwerror.rb', line 22

def inspect
  "#{@message} (code #{@code}, group #{@group}, type #{@type}, number #{@number})"
end