Has anybody figured out the syntax for the "Except" area of a try-except-end
grouping ? (Delphi 1)
It seems that you can put any code into the except that you wish, UNLESS you
put in an ON statement, e.g. On EDivByZero do .....
Once you insert an On statemnt, the On statement becomes the ONLY thing
allowed in the except. If you put other code in front of it, you get Error
113, "Error in Statement". If you put other code after the On, you get
Error 177, "ON Expected".
Can anybody explain why the ON statement makes anything else illegal ? Is
this behaviour documented anywhere ?
The problem that this causes is that if you want anything executed
unconditionally in case of error, you have to repeat it twice, e.g.
try
...
except
On EDivByZero do
begin
DoDivByZeroThing ;
DoUnconditionalThing ;
end
else DoUnconditionalThing ;
end;
The duplication is needed since the following is illegal ...
except
On EDivByZero do DoDivByZeroThing ;
DoUnconditionalThing ;
end;
The Object Language Manual (Acrobat OBJLANG.PDF) has a syntax diagram in
Chap. 10 that seems to suggest the following might be legal, but the
compiler won't take it ...
except
On EDivByZero do DoDivByZeroThing ;
except
DoUnconditionalThing ;
end;
All suggestions welcome !
--- PPoint 2.00
---------------
* Origin: Kingston, Canada (1:249/109.11)
|