Todays winning code in a TThread descendent:

Todays winning code in a TThread descendent:

except
  on e:exception do begin
    Application.ProcessMessages;
  end;
end;

Quite why that would be the only response to an exception I am unable to work out. I suspect it means "pause, then continue". Doing so from a thread is even more interesting. I wonder if this code that someone just kept playing with until it seemed to work?

The cargo cult use of "on e:exception" is just unnecessary.

Comments

  1. It might be possible that this on e: exception is a left over from previous code that actually did something with e.

    ReplyDelete
  2. After leaving the 16-bit world. I've never used ProcessMessages.  I do have many on e:exception though - mostly for logging, handling or inspection.

    ReplyDelete
  3. Lars Fosdal Those imply that you're actually referencing e in the handler, unlike the exception eating deadlock inducing nightmare above.

    ReplyDelete

Post a Comment