Exception Handling in Delphi
Exceptions are a vital language structure of any modern programming language. This posting shows the usage of Delphi’s exceptions.
To raise an exception:
raise Exception.Create('Your exception message');
Excepion is general exception class. Of course you can define your own Exception classes.
To catch exceptions you have several options:
try
// your code
except
// exception handling
end;
try
// your code
except on e:Exception do
// exception handling, for example :
showmessage(E.Message);
end;
The combination of except and finally sections looks like this:
try
try
// your code
except on e:exception do begin
// exception handling
end;
finally
// finally section
end;

A+ would read again
author: mode20100 | August 26th, 2010 at 1:00 am