try except madness
..or should I say “try and accept some madness”?
Today I came across this little gem inside of a CloseQuery event handler of a form:
CanClose := bIsInitialisationsOver;
on E: Exception do
WriteErrorToLog('Error.Exception - ' + E.Message);
CanClose is a boolean variable that is part of the handler. bIsInitialisationsOver is also a boolean variable. One just has to question what some people are thinking when they feel they need to capture an exception of assignment of a boolean to another boolean. Incidentally, this wasn't an isolated example; there were other instances of similar coding style.
Tags: Delphi stuff
Please login first in order for you to submit comments