I am using Delphi Pro 6 on Windows XP with FastMM 4.92 and JEDI JVCL 3.0. Given the code below, I have the following problem: only the first exception handling block receives a valid instance of E. Other blocks correspond to the rule with the exception raising class, but E is not assigned (nil).
For example, given the current order of exception handling blocks, when I raise E1, the block for E1 matches, and E is a valid instance of the object. However, if I try to raise E2, this block will match, but E is not assigned (nil). If I moved the capture block E2 to the top of the order and raise E1, then when the block E1 corresponds to E, it is no longer assigned. With this new ordering, if I raise E2, E is correctly assigned when it was not, when the E2 block was not the first block in the order. Note. I tried this case with a bare-bones project consisting of just one Delphi form.
Am I doing something really stupid here or is something really wrong?
Thanks Robert
type E1 = class(EAbort) end; E2 = class(EAbort) end; procedure TForm1.Button1Click(Sender: TObject); begin try raise E1.Create('hello'); except On E: E1 do begin OutputDebugString('E1'); end; On E: E2 do begin OutputDebugString('E2'); end; On E: Exception do begin OutputDebugString('E(all)'); end; end; // try() end;
null exception try-catch delphi except
Robert Oschler
source share