Re: Trapping Exceptions; possible with indy?

Giganews Newsgroups
Subject: Re: Trapping Exceptions; possible with indy?
Posted by:  RobertW (
Date: Fri, 31 Oct 2003

Hmm, I just tried wrapping my try/finally block with another try/except
block and now it seems to be working...

I guess the exception was being passed to the try/finally block and not
being handled, so windows was throwing an acess violation.

Ok, well; at least its working now  :)


"RobertW" <> wrote in message
> 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
> lines in the indy code then the app works much better, but I dont want to
> 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



In response to

Trapping Exceptions; possible with indy? posted by RobertW on Fri, 31 Oct 2003