🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.objectpascal
1 messages
1 total messages Started by John Tue, 06 Jul 2004 18:06
Re-raising exception causes access violation
#19
Author: John
Date: Tue, 06 Jul 2004 18:06
33 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads