|
|
To catch an error caused by an operation, a procedure must call the operation indirectly by using ErrorCatch(TCL_ADM). This is similar to using catch(TCL), but ErrorCatch allows you to manage the error stack. If the error is serious enough to stop processing, you can add additional information to the error stack by calling ErrorPush with the error ID that describes the error.
Template sample code: ErrorCatch/Push
if {[ErrorCatch stack 0 [list CallNonStdCmd $cmd $args $errId] data]} {
ErrorPush stack 0 [IntlErrId WHO_UNABLE]
UiDisplayErrorStacks WhoGetData $stack
return {}
UiDisplayErrorStacks uses
SaDisplayErrorStacks(TCL_ADM)
to display an error box showing the top level error text
from the stack. It provides a Details
button for viewing the complete
stack. The Details dialog also provides
a Save button for logging
the error stack to a file for future reference.
An optional Help button can be included
where relevant help attachments are available.
Template procedure: SaDisplayErrorStacks
proc UiDisplayErrorStacks {caller stack {callback ""}} {
global appvals
if {$appvals(autorefresh)} {
SaAutoRefreshPause
}
SaDisplayErrorStacks $appvals(vtMain).$caller [list $stack] HELP \
[list UiDisplayErrorStackCB $callback]
}
SaDisplayErrorInfo provides for displaying a simple text string rather
than a fully formed error stack. It creates a standard stack which
contains the topErrorText and then calls
SaDisplayErrorStacks. This
results in consistent error presentation regardless of its source.
See also: