home *** CD-ROM | disk | FTP | other *** search
- program Except2;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: EXCEPTS }
-
- { Using exceptions to print your own errors rather than a default error.
- Once again, the EOutOfMemory is being called explicitly not because
- you are out of memory, but just to demonstrate that exceptions
- are a means of handling errors, and are not the errors themselves.
- See the EXCEPT1 program for more info on this subject. }
-
- uses
- SysUtils,
- WinCRT,
- WinProcs;
-
- var
- B: Boolean;
- begin
- B:= False;
- WriteLn('hi');
- try
- if not b then
- raise EOutOfMemory.Create('sambo');
- except
- on EOutOfMemory do WriteLn('Aha!');
- end;
- end.
-