Article

From:
To:
Greg Lorriman
Subject:
Re: Exceptions vs Error codes
Newsgroup:
borland.public.delphi.objectpascal

Re: Exceptions vs Error codes

Greg

>
>     if not fileExists(edit1.text) then raise exception.create('No such path
> or filename');
>     modalresult:=mrOk;
> end;
>

Why would you need to raise an exception here?  Why not just open a dialog?
Isn't the usual way to handle exceptions with try-except blocks?  The idea
is that you can interrupt the program's normal flow of control by catching
exceptions and performing special handling in those cases, and moving back
to an earlier point in the routine or call stack.  If you are checking a
condition explicitly and the flow continues from there, then I don't see the
need for the raise.  Seems like a waste of resources.

Joe
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Wed, 13 Nov 2024 06:31:06 UTC
Copyright © 2009-2024
HREF Tools Corp.