home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programming Unleashed / Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso / misc / excptexp / excepts / except2.dpr < prev    next >
Encoding:
Text File  |  1995-03-21  |  682 b   |  29 lines

  1. program Except2;
  2.  
  3. { Program copyright (c) 1995 by Charles Calvert }
  4. { Project Name: EXCEPTS }
  5.  
  6. { Using exceptions to print your own errors rather than a default error.
  7.   Once again, the EOutOfMemory is being called explicitly not because
  8.   you are out of memory, but just to demonstrate that exceptions
  9.   are a means of handling errors, and are not the errors themselves.
  10.   See the EXCEPT1 program for more info on this subject. }
  11.  
  12. uses
  13.   SysUtils,
  14.   WinCRT,
  15.   WinProcs;
  16.  
  17. var
  18.   B: Boolean;
  19. begin
  20.   B:= False;
  21.   WriteLn('hi');
  22.   try
  23.    if not b then
  24.       raise EOutOfMemory.Create('sambo');
  25.   except
  26.       on EOutOfMemory do WriteLn('Aha!');
  27.   end;
  28. end.
  29.