home *** CD-ROM | disk | FTP | other *** search
- program Except1;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: EXCEPTS }
-
- { This program shows that you can raise a Delphi exception
- even though no error occured. The point is that exceptions
- are just a device for reporting and handling errors, they
- are not necessarily associated with the errors themselves.
- In a DOS app, if you called WriteLn to tell the user that
- an error occurred, there is no necessary connection between
- WriteLn and the error. WriteLn just a function you are using
- to report the error. The same is true with exceptions. You
- could use them for some totally different purpose having
- nothing to do with error handling, they just happen to
- be a good means of reporting errors. In fact, they were
- designed specifically, and more or less exclusively, for
- that purpose. But you could use them for some other purpose
- if you wanted. }
-
- uses
- SysUtils,
- WinCRT,
- WinProcs;
-
- var
- b: Boolean;
-
- begin
- b:= False;
- WriteLn('hi');
- if not b then
- raise EOutOfMemory.Create('This is a test!');
- end.
-