Allen Vander Meulen
2003-09-25 19:45:11 UTC
OK, I'm puzzled.
I can write code in C++ that allows me to clean up following specific
types of exceptions and then re-raise them to "bubble up" to the
calling procedure for further recovery. I've tried just about every
variation of this that I can think of in Delphi, and none work, or
produce odd behavior. Does anyone have any suggestions?
This works (obviously) ...
try
{ ... }
raise ECustomException;
{ ... }
except
on e: ECustomException do dothis; // (a single line of code)
else
dothat;
end;
And this works (also, obviously) ...
try
{ ... }
raise ECustomException;
{ ... }
except
dothis;
dothat;
raise;
end;
However, if I use the "on ... do" construct, I can't re-raise
exceptions, or do anything requiring multiple statements, like this:
try
{ ... }
raise ECustomException;
{ ... }
except
on e: ECustomException do
begin
dothis;
dothat;
raise;
end;
else
begin
dothat;
raise;
end;
end;
- Allen
I can write code in C++ that allows me to clean up following specific
types of exceptions and then re-raise them to "bubble up" to the
calling procedure for further recovery. I've tried just about every
variation of this that I can think of in Delphi, and none work, or
produce odd behavior. Does anyone have any suggestions?
This works (obviously) ...
try
{ ... }
raise ECustomException;
{ ... }
except
on e: ECustomException do dothis; // (a single line of code)
else
dothat;
end;
And this works (also, obviously) ...
try
{ ... }
raise ECustomException;
{ ... }
except
dothis;
dothat;
raise;
end;
However, if I use the "on ... do" construct, I can't re-raise
exceptions, or do anything requiring multiple statements, like this:
try
{ ... }
raise ECustomException;
{ ... }
except
on e: ECustomException do
begin
dothis;
dothat;
raise;
end;
else
begin
dothat;
raise;
end;
end;
- Allen