Re: Why does indy use exceptions for control flow.

Giganews Newsgroups
Subject: Re: Why does indy use exceptions for control flow.
Posted by:  Chad Z. Hower aka Kudzu (cp…
Date: Sat, 13 Sep 2003

Karl <no_email.no_place.home> wrote in
> I am curious why the Indy components use exceptions for program control
> flow.

Because exceptions are the proper way to kick out of nested procedures.
That is unless you make each and EVERY method have a return code and add
billion if's. The the Delphi code would look like C.

>  FTP->List(files, "fileThatDoesNotExist", True);
>  I get a EIdProtocolReplyError if the file does not exist. To me this
>  is
> not an exception, this is an expected result for which I'd expect a list

In this case a return value may make more sense if the condition is
"reasonably expected".

> Exceptions are intended to seperate program code from error handling,


Exceptions are called Exceptions, not errors. Search through the VCL for
Abort and EAbort. The only differnce is that by default the IDE is told to
ignore EAbort in the IDE.

> I have also noticed the the List method also raises
> EIdConnClosedGracefully which is handled before reaching user code, but
> which is exposed by the BCB debugger. This has confused a few people as
> you can see from reading this newsgroup..

Please read this:
"Connection Closed Gracefully" at:


In response to

Why does indy use exceptions for control flow. posted by Karl on Sat, 13 Sep 2003