troubleshooting Question

try ... except ignored

Avatar of APS NZ
APS NZFlag for New Zealand asked on
Delphi
6 Comments1 Solution302 ViewsLast Modified:
I am processing data from a stringgrid into a table and have the code block below which should give a silent error and add the detail to my log file, but instead the program stops if it encounters a duplicate record and throws a standard error message, then will not process any more data.

The problem is inconsistent, because I use try ... except blocks in other parts of the code, and they work as expected - throwing a silent error and adding detail to the log.

I am not running inside the IDE.  Am I missing something ....?

procedure TForm1.AddToCCOExtras(Cde: String; ACol: Integer);
begin
     If FindExtrasCode(Cde) then
     begin
          Table1.Append;
          With Table1 do
          begin
               AddHeader;
               AddTempDetails;
               AddExtrasCode(ACol);
          end;
          If Not Missing then
          begin
               try
                  Table1.Post;
               except
                  AddToErrorLog(' Duplicate person:');
               end;
          end;
     end else AddToErrorLog(' Code '+Cde+' missing from JobOrder ');
end;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros