[fpc-pascal]exception handling

kractor baron.kractor at cogeco.ca
Wed Mar 17 01:20:39 CET 2004


spent a few moments going over the docs in the manual re: exception 
handling. for some reason it just doesn't seem to be sinking in, as 
nothing i've tried as of yet has managed to stop prog from crashing when 
data in input that's of a different type than program is expecting 
(string as opposed to integer, for example).

as i said, i'm pretty sure that its something really small and obvious, 
i'll include a few lines here ... maybe someone can spot my mistake ... 
pretty sure its the EConvertError and that there's a pre-defined error 
type that I just haven't come across yet.

        try
            readln(NewAlbum.Year);
        except
            on EConvertError do NewAlbum.Year := 0;
        end;




More information about the fpc-pascal mailing list