Para debate:
Ya alguna vez se debatió acerca de esto y reafirmo mi opinión:
Las excepciones deben usarse para controlar errores que no podemos detectar a tiempo, no para cualquier cosa que un simple condicional previo nos evitaría.
Incluso la misma ayuda de Delphi dice:
Cita:
Empezado por Ayuda de delphi
Conditional statements are often the best way to test for errors. For example, suppose you want to make sure that a file exists before trying to open it. You could do it this way:
Código Delphi [-]
try
AssignFile(F, FileName);
Reset(F); except
on Exception do ...
end;
But you could also avoid the overhead of exception handling by using
Código Delphi [-]
if FileExists(FileName) then begin
AssignFile(F, FileName);
Reset(F);
end;
|
// Saludos