NxLibException

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

class NxLibException

Public Functions

inline NxLibException(std::string const &_itemPath, int _errorCode, std::shared_ptr<NxLibItemToken> _token = nullptr)
Parameters
  • _itemPath – The path to the tree node, which caused the exception.

  • _errorCode – The error code that occurred while accessing the node.

  • _token – An optional NxLibItemToken to keep the execution slot of an NxLibCommand alive while this exception instance exists.

inline int getErrorCode() const

The NxLib.

error code that caused this exception.

inline std::string const &getErrorText() const

The text description of the failure as returned by nxLibTranslateReturnCode().

inline std::string const &getItemPath() const

The path to the tree node on which the failed operation was attempted.

inline bool isCommandExecutionFailure() const

Whether this exception results from the failed execution of an NxLibCommand.

Exceptions resulting from failed command execution can have more information than those generated purely from C-API error codes : an additional error symbol (getCommandErrorSymbol()) and error text (getCommandErrorText()) that were returned by the command and describe the error in more detail.

std::string getCommandErrorSymbol() const

The error symbol returned by the command execution.

Only available if the exception was thrown because execution of an NxLibCommand failed. You can check this using isCommandExecutionFailure(). If the node containing the error symbol does not exist the method will throw another NxLibException.

std::string getCommandErrorText() const

The error text returned by the command execution.

Only available if the exception was thrown because execution of an NxLibCommand failed. You can check this using isCommandExecutionFailure(). If the node containing the error text does not exist the method will throw another NxLibException.

inline std::shared_ptr<NxLibItemToken> const &getToken() const

Token that holds an NxLibItem.