|
|
This is NOT the latest version, which is available at: current
Exception Handling in DaoDao exceptions are organized into hierarchal structured classes. The base class is Exception ,
class Exception( content='' )
Currently supported classes are the following:
{ protected my Rout = ''; my File = ''; my FromLine = 0; my ToLine = 0; public my Name = 'Exception'; my Content : any = 'undefined exception'; if( content ) Content = content; }
Any running time error will raise a proper exception instance. User-defined exception can be raised by using raise statement. Exceptions can be rescued by a block of code after a rescue statement The exception handling syntax is the following:
stmt_tryrescue ::=
where expr is a list of exception class(es).
If there is no expr following rescue , any exception will be rescued.
There can be multiple rescue statements in a try-rescue block.
The raised exceptions will be checked against the exception classes presented in
each of the rescue statement, if there is a matching, the corresponding code
block is executed, and the rescued exceptions can be accessed in a global list named
exceptions . In the same try-rescue block different rescue statements
can be used to handle different exceptions. 'try' '{' stmt_block { '}' 'rescue' [ '(' expr ')' ] '{' stmt_block }* '}' If all rescue statements have been tried and there is still un-rescued exception(s), the current function is aborted and the exceptions(s) is raised to its caller, if there is; otherwise, the program is aborted with the values of the un-rescued exceptions printed out. In a rescue statement, one may modify exection condition, and use retry to invoke the codes in try block. Examples,
try{
raise Exception.Error( "error test" ), Exception.Warning( "warning test" ), Exception( "exception" ); }rescue( Exception.Error, Exception.Warning ){ stdio.println( exceptions ); }rescue{ stdio.println( "rescued" ); }
view count 433 times
created at 2009-09-18, 06:38 GMT |
fu: ... I forgot to say something about the plan for the whole new year in my previous reply. Well, besides w ... (Jan.19,01:40) fu: ... Happy new dragon year (which will start from this sunday)! Actually, it was a busy month (I wish th ... (Jan.18,22:46) ybabel: What's the plan for the new year ? Hello 'vry budy :- ) happy new year (when is the new year for you Fu ?) I saw you come back and comm ... (Jan.18,18:59) |