NxLibException

class nxlib.exception.NxLibError(message=None)

This class represents an NxLib API error.

Parameters

message (str, optional) – The error messgae to be displayed. Defaults to None.

class nxlib.exception.NxLibException(path, error_code, command=None)

This class encapsulates NxLib API errors. All methods of NxLibItem and NxLibCommand not taking a return code pointer will throw an NxLibException when the API return code indicates an error.

It is possible to store the NxLibCommand object that caused the exception to keep temporary slots alive while an exception exists.

Parameters
  • path (str) – The path to the NxLibItem that caused the exception.

  • error_code (int) – The NxLib error code.

  • command (NxLibCommand, optional) – The command object that cause the exception. Defaults to None.

get_error_code()

Retrieves the API return code that has caused this exception.

Returns

The error code because of which the exception was raised.

Return type

int

get_error_text()

Retrieves the error text, corresponding to the API return code that has caused this exception. This is the error text return by nxlib.api.translate_error_code().

Returns

The text corresponding to the error code.

Return type

int

get_item_path()

Retrieves the path of the item that was attempted to access when the exception was raised.

Returns

The path of the item that has caused the exception.

Return type

str