Ensenso::NxLibException¶
- class Ensenso.NxLibException : public Exception¶
This class encapsulates NxLib API errors.
All overloaded functions of NxLib and NxLibCommand not taking a return code parameter will throw an NxLibException when the API return code indicates an error.
Public Functions
- NxLibException (string itemPath, int errorCode, NxLibItemToken token = null)¶
Creates a new NxLibException.
- Param itemPath
The path to the tree node, which caused the exception.
- Param errorCode
The return code that occurred while accessing the node.
- Param token
An optional
NxLibItemToken
to keep the execution slot of an NxLibCommand alive while this exception instance exists.
- int GetErrorCode ()¶
Returns the error code that caused this exception.
- Return
The return code .
- string GetErrorText ()¶
Returns the text description of the failure as returned by
NxLib.NxLibTranslateReturnCode()
.- Return
The text description of the failure.
- string GetItemPath ()¶
Returns the path to the tree node on which the failed operation was attempted.
- Return
The path.
- NxLibItemToken GetToken ()¶
Returns the token that holds an NxLibItem.
- Return
The token.
- bool IsCommandExecutionFailure ()¶
Returns 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 and error text that were returned by the command and describe the error in more detail.
- Return
Whether this exception results from the failed execution of an NxLibCommand.
- string GetCommandErrorSymbol ()¶
Returns 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.- Return
The error symbol returned by the command execution.
- string GetCommandErrorText ()¶
Returns 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.- Return
The error symbol returned by the command execution.