Avoid endless loop of errors

Asked

Viewed 717 times

1

I would like to know if you can avoid the occurrence of infinite loops of errors in Delphi XE2. These errors are usually critical errors of missing some file (like DLL) or without permission to access something.

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

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

Below an example of message:

Exemplo de erro

  • 6

    The way to avoid this repetition of a serial exception is to understand what the cause is and eliminate this cause. If you know what causes the exception, you can fix or treat.

1 answer

4


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

See the example below where it deals with 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 cast by Debugger, make the following route:

ToolsOptionsDebugger OptionsLanguage Exceptions, disable the check-box Notify on language exceptions.

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.