From: Marc MERLIN <marc_mh@me...> - 2010-07-18 02:16:21
The Omnistat module has a bit of code that is equivalent to 'assert': if
something wrong happens, it dies.
Notably, it could be 2-3 levels deep in a function where I'm reading raw
data from the thermostat and I'm getting garbage or a timeout.
Die is nice because I can just exit right there, log the error which I see
in a special file (error_log) and I don't have to worry about sending error
codes back and dealing with them everywhere (I can't just return since I
don't have proper data to return).
But, if I die 2 or 3 times, mh will disable my module, which I really don't
I currently have code that detects that and restart mh, but this is
obviously a horrible kludge.
Is there a better way to die within user code without getting disabled?
(I'd be happy with "warn foo; continue", with "continue finishing the
current big mh loop or at least my code and starting the next run.
Hell, if I had goto, I would just goto to the end of my module so that it
gets skipped this time around.
(note that I can die 2 levels deep in a function, so it's not actually that
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/