DAX Error Stack
From Daxipedia
Contents |
[edit] DAX Dev Error Stack
The DAX error stack allows developers to determine if an error has occurred when they called one of the Dax_Dev_@ methods. If an error occurs it is added to the end of the stack. The error stack is process level.
[edit] DAX_Dev_ERR_ClearErrorStack
Reset or Define the error arrays. This method defines, or clears the existing, error arrays. It is called at the beginning of every DAX web process, as well as in the initialize, shutdown, and Daemon processes. You can call this method at any time to clear all the errors currently in the stack. If you were to call one of the DAX_Dev_@ methods within a new process (not recommended) you must first call this method.
Example
To reset the error stack:
DAX_Dev_ERR_ClearErrorStack
[edit] DAX_Dev_ERR_ErrorsExist
Returns True if errors have occurred in this process. You can call this method after any call to a DAX_Dev_@ method to check if an error has occurred.
[edit] Parameters
Passed:
None
Returned:
$0 BOOLEAN - True if any errors have occurred
Example
To determine if any errors have occurred:
If (DAX_Dev_ERR_ErrorsExist) ` handle the error End if
[edit] DAX_Dev_ERR_GetErrorCount
Returns the total number of errors in the stack. You can call this method to determine the total number of errors in the stack.
[edit] Parameters
Passed:
None
Returned:
$0 LONGINT - Total number of errors in the stack
Example
To get the error code for the last error that occurred:
If (DAX_Dev_ERR_ErrorsExist) $totalErrors_l:=DAX_Dev_ERR_GetErrorCount End if
[edit] DAX_Dev_ERR_GetErrorCode
Return the error code for a given error index. You can call this method to retrieve the DAX error code for a given error in the stack.
[edit] Parameters
Passed:
$1 LONGINT - Index in the error stack
Returned:
$0 LONGINT - Error code for given index
Example
To get the error code for the last error that occurred:
If (DAX_Dev_ERR_ErrorsExist) $errorCode_l:=DAX_Dev_ERR_GetErrorCode(DAX_Dev_ERR_GetErrorCount) End if
To get the error code for the first error that occurred:
If (DAX_Dev_ERR_ErrorsExist) $errorCode_l:=DAX_Dev_ERR_GetErrorCode(1) End if
[edit] DAX_Dev_ERR_GetErrorLocation
Return the name of the method where the error occurred for a given error index. You can call this method to retrieve the name of the method where a given error occurred.
[edit] Parameters
Passed:
$1 LONGINT - Index in the error stack
Returned:
$0 TEXT - Name of the method that reported an error for the given index
Example
To get the name of the method where the last error occurred:
If (DAX_Dev_ERR_ErrorsExist) $errorLocation_t:=DAX_Dev_ERR_GetErrorLocation(DAX_Dev_ERR_GetErrorCount) End if
To get the name of the method where the first error occurred:
If (DAX_Dev_ERR_ErrorsExist) $errorLocation_t:=DAX_Dev_ERR_GetErrorLocation(1) End if
[edit] DAX_Dev_ERR_GetErrorText
Return the error text for a given error index. You can call this method to get the actual error text for a given error in the stack.
[edit] Parameters
Passed:
$1 LONGINT - Index in the error stack
Returned:
$0 TEXT - Error text for the given index
Example
To get the error text for the last error that occurred:
If (DAX_Dev_ERR_ErrorsExist) $errorText_t:=DAX_Dev_ERR_GetErrorText(DAX_Dev_ERR_GetErrorCount) End if
To get the error text for the first error that occurred:
If (DAX_Dev_ERR_ErrorsExist) $errorText_t:=DAX_Dev_ERR_GetErrorText(1) End if
[edit] DAX_Dev_ERR_GetErrorTextByCode
Returns the error text for a passed error code. Note the difference from DAX_Dev_ERR_GetErrorText is that this is independent from the error stack. You can call this method to get the actual error text for any given DAX error number.
[edit] Parameters
Passed:
$1 LONGINT - Valid DAX error code
Returned:
$0 TEXT - Error text for the given error code
Example
To get the error text for a DAX error that occurred:
$errorText_t:=DAX_Dev_ERR_GetErrorTextByCode(-1)
