Trapping Exceptions; possible with indy?

Giganews Newsgroups
Subject: Trapping Exceptions; possible with indy?
Posted by:  RobertW (robcompusano@spamhotmail.com)
Date: Fri, 31 Oct 2003

Hello All, this is my first post in this group.

Im using indy version 9_00_14.

When Indy Raises an exception, in most or all of the units, my application
crashes with an access violation. Even if I wrap the exception in a
try/except block, I cannot seem to stop indy from crashing the whole
program.

Im using the nntp component inside a thread. My execute procedure is like
so:

try//finally try
  try//except try
    with client do
    begin
      Connect(3000);//3 second timeout
      if connected then SelectGroup(NewsGroup) else Sleep(250);
      if pos('No such group',LastCmdResult.Text.Text) > 0 then Abort;
  end;
except on e:exception do if e.message <> 'Operation aborted' then Abort;
else Abort; end;
finally CloseThread; end;

The problem comes when the SelectGroup procedure raises a 'no such group'
error. I know for sure the indy component is causing the access violations
because the compiler highlights the 'Raise [put exception here]' lines in
the indy source code. If I run the .exe outside the compiler I just get an
access violation. I get the same problem with all other indy exceptions;
connection timed out, connection closed gracefully; they all crash my app
with an access violation. If I comment out the 'Raise [put exception here]'
lines in the indy code then the app works much better, but I dont want to be
blind to exceptions! I want to log them & would rather catch them in my
except block.

Im using Delphi 5 Pro Build 6.18 update pack1

Thanks for any help!!

-Rob

Replies