pascalabcnet/TestSuite/exceptions2.pas

16 lines
388 B
ObjectPascal
Raw Permalink Normal View History

2017-05-23 21:36:10 +03:00
type
MyException1 = class(Exception);
MyException2 = class(Exception);
IncorrectInputException = class(Exception);
begin
var s := '';
try
raise new MyException1('EXCEPTION2!!');
except
on e: IncorrectInputException do writeln(e.Message);
on e: MyException1 do s := e.Message;
on e: MyException2 do writeln(e.Message);
end;
assert(s = 'EXCEPTION2!!');
end.