When writing an exception raise in Delphi, a common mistake is to omit the raise,
causing the exception to be created but not actually used. This is bad for a number of reasons:
Add the raise keyword. If the exception is not required, delete the constructor invocation instead.
procedure DeleteDatabase;
begin
if InProductionEnvironment then begin
EDontBreakProduction.Create('DeleteDatabase attempted in production');
end;
Database.DeleteAllImportantRecords;
end;
procedure DeleteDatabase;
begin
if InProductionEnvironment then begin
raise EDontBreakProduction.Create('DeleteDatabase attempted in production');
end;
Database.DeleteAllImportantRecords;
end;