[fpc-pascal]'try-except'-problem

Dominik Schulz dschulz at c-nit.de
Sat Sep 16 17:01:42 CEST 2000


"Tobias Hermann" wrote:
> haven't you to use something like this? :
> 
> try
>   ..
> except
>   on Exception do
>    writeln('Error');
> end;

I tried it, but still got RE 200.

-------------------------------------------------
program testtry;
{$mode delphi}

uses crt, sysutils;

var a, b : word;

begin
  writeln('start');
  a :=  1;
  b :=  a - 1;
  try
    a := 1 div b;
  except
    on exception do writeln('error');
  end;

  writeln('end');
end.
-------------------------------------------------

Removing ', sysutils' the compiler puts out this:
-------------------------------------------------
Compiling testtry.pas
testtry.pas(16,18) Error: Identifier not found EXCEPTION
testtry.pas(16,18) Error: class type expected, but got "<erroneous type>"
testtry.pas(22) Fatal: There were 2 errors compiling module, stopping
-------------------------------------------------

I do not know any class, which I could use here.

                        Dominik





More information about the fpc-pascal mailing list