Avoid infinite loop of errors

1

I would like to know if there is a way to avoid infinite loops of errors in Delphi XE2. These errors are usually critical errors of missing a file (like DLL) or without permission to access something.

I use exception handling, but in very sporadic cases some of these errors occur, but it becomes impossible to terminate the application without being Windows Task Manager, because clicking on the OK of the message another one appears.

Someone has a tip on how to avoid this loop, even if you need to end the application

Below is an example of a message:

    
asked by anonymous 09.01.2015 / 20:00

1 answer

4

As quoted by @Caffe in comment, the correct would be to capture the exceptions released and treat them. The Access Violation error is somewhat critical, assuming that exceptions of the gender occur to the end user. your program, it is certain that you will have problems in the future.

See the example below for handling specific errors.

Try
   // Fazer algo aqui.
Except
   On E : EInOutError do 
     // Não é possível alocar memória
     // Tratar esse erro aqui.

   On E : EAccessViolation do 
     // Violação de acesso
     // Tratar esse erro aqui 

   On E: EExternalException do
     // Erro Interno
     // Tratar esse erro aqui.
   else
     ShowMessage('Erro desconhecido. Contate o administrador do sistema.');
end;

However, if you want to prevent exceptions from being thrown by the Debugger , do the following route:

ToolsOptionsDebugger OptionsLanguage Exceptions , disable the Notify on language exceptions .

    
09.01.2015 / 22:35