Article View: borland.public.delphi.language.objectpascal
Article #19Re-raising exception causes access violation
From: John
Date: Tue, 06 Jul 2004 18:06
Date: Tue, 06 Jul 2004 18:06
33 lines
1836 bytes
1836 bytes
I have some code that raises custom exceptions for specific errors
while processing data. In the calling code I am trapping all
exceptions in a try/except and checking to see if the exceptions are
of my custom type. If so it will perform an extra instruction and
re-raise the exception. If not I simply re-raise the exception. The
problem is that I've found that calling the raise method in the
try/except causes an A/V for some inexplicable reason.
For example:
try
ValidateMeter;
except
on E:Exception do
begin
if E is ETFPValidationError then
begin
ExceptionType := etMeter;
raise;
end
else
raise;
end;
end;
In the above if the BDE raises an exception, like for AsDateTime
conversion error, I will end up seeing an A/V while the real error is
lost. I've tried several variations on this same idea, yet they have
all resulted in A/Vs or syntax errors. What am I missing here??
Thx,
John
Technical Details
Message-ID:
<39ed5af.0407061006.351bbb65@posting.google.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 109d30,7813d164afe8d3ac,start X-Google-Attributes: gid109d30,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail From: ibidibi411@hotmail.com (John) Newsgroups: borland.public.delphi.language.objectpascal Subject: Re-raising exception causes access violation Date: 6 Jul 2004 11:06:17 -0700 Organization: http://groups.google.com Lines: 33 Message-ID: <39ed5af.0407061006.351bbb65@posting.google.com> NNTP-Posting-Host: 208.247.4.178 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1089137178 5871 127.0.0.1 (6 Jul 2004 18:06:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 6 Jul 2004 18:06:18 +0000 (UTC)