Difference between revisions of "Ns adp exception"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 864)
 
 
Line 1: Line 1:
'''ns_adp_exception''' ''?state?''
+
'''ns_adp_exception''' ''?stateVar?''
  
 
This function is used to examine  the  current  ADP
 
This function is used to examine  the  current  ADP
Line 5: Line 5:
 
exception state is ok and 1 otherwise.
 
exception state is ok and 1 otherwise.
  
If the optional state argument is passed,  a  vari-
+
If the optional stateVar argument is passed,  a  variable with the provided name will be set for the caller, and
able with that name will be set for the caller, and
 
 
will contain the exception state with  one  of  the
 
will contain the exception state with  one  of  the
 
following possible values:
 
following possible values:
Line 17: Line 16:
 
* '''break'''     
 
* '''break'''     
 
:  ns_adp_break was called
 
:  ns_adp_break was called
 +
* '''return'''   
 +
:  ns_adp_return was called
 
* '''unknown'''   
 
* '''unknown'''   
 
:  Unrecognized exception status.  This should not occur.
 
:  Unrecognized exception status.  This should not occur.
 +
 +
The purpose of this function is to be able to tell apart a regular Tcl exception that you caught with catch or an exception that was raised by [[ns_adp_abort]], [[ns_adp_break]] or [[ns_adp_return]].

Latest revision as of 23:03, 13 June 2010

ns_adp_exception ?stateVar?

This function is used to examine the current ADP exception state. The function returns 0 if the exception state is ok and 1 otherwise.

If the optional stateVar argument is passed, a variable with the provided name will be set for the caller, and will contain the exception state with one of the following possible values:

  • ok
ADP was evaluated successfully
  • overflow
Stack overflow occurred. This might happen, for example, if there was a recursive call to ns_adp_include.
  • abort
An attempt to debug failed or ns_adp_abort was called.
  • break
ns_adp_break was called
  • return
ns_adp_return was called
  • unknown
Unrecognized exception status. This should not occur.

The purpose of this function is to be able to tell apart a regular Tcl exception that you caught with catch or an exception that was raised by ns_adp_abort, ns_adp_break or ns_adp_return.