What is the process of exception handling in Delphi?

What is the process of exception handling in Delphi?



The process of exception handling is as follows:

- Allocate the memory and use the try block to execute the statements. The statements written in the try block will help to produce the error or it will raise an event.

- After the error occurs then the try block will be skipped and it will be catched by the finally block.

- In case of no error the finally block will be executed only after the last statement of the try block.

- The memory gets freed due to handling of exceptions in a proper way.

- The try and finally blocks are used to trap any exception that comes under way.

- Providing of an “except” block that allows the handling of local errors or all the errors that can create the global error handler.

- The program shows the use of exception handling:
p := new(hello);
try
me(p);
foo(p);
finally
dispose(p);
end;
Post your comment