home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / norskdata / ndkfau.pas < prev    next >
Pascal/Delphi Source File  |  2020-01-01  |  2KB  |  49 lines

  1. (* tab p;
  2.  *
  3.  *      ND-Pascal offers the ability to trap any run-time errors
  4.  *      by writing a special procedure.  When transmission is going,
  5.  *      this is strongly desirable, espessially during program development.
  6.  *      The below procedure will write an error-emssage on the debug-file
  7.  *      (if one is defined), and terminate.  It may be possible to write
  8.  *      an error-packet in the future also.
  9.  *
  10.  *)
  11.  
  12.     procedure   fault( erno, lino, objad, sinerr : integer );
  13.     var     Status : integer;
  14.     begin   (* fault *)
  15. (*
  16.  *      This test is removed in the official "release".  It ensures
  17.  *      that any run-time error is trapped and reported, even if a debug
  18.  *      file has not been connected/defined.  I don't think this is a
  19.  *      "clean" way of doing it, but it may be inserted if you so wish.
  20.  *
  21.  *      if not DbgConnected then
  22.         begin
  23.             connect(DbgOut,'DEBUG','KERM','WA',Status);
  24.             if Status <> 0 then
  25.             begin
  26.                 connect(DbgOut,'"DEBUG"','KERM','WA',Status);
  27.                 DbgConnected := Status = 0;
  28.             end else
  29.                 DbgConnected := true;
  30.             if DbgConnected then
  31.                 rewrite(DbgOut);
  32.         end;
  33. *)      if DbgConnected then
  34.         begin
  35.             writeln(DbgOut,'PASCAL Run-time error no.   ',erno);
  36.             writeln(DbgOut,'Error   occurred  at line   ', lino);
  37.             writeln(DbgOut,'                  at objad ', objad:6:8);
  38.             if erno in (.
  39.                 17, (* connect error *)
  40.                 37  (* I/O Error     *)
  41.                         .) then
  42.             begin
  43.                 writeln(DbgOut,'Sintran error code: ', sinerr );
  44.             end;
  45.             disconnect(DbgOut);
  46.         end;
  47.     end;    (* fault *)
  48. 
  49.