? about reporting errors

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have found myself being a bad programmer. I know I should trap errors and
exceptions and log them, but I'm not.... everywhere. I DO when the error
happens in my Form class because that is where I initially setup my error
log. I find now, after adding 30+ classes that when an error happens in
them, I don't do anything because I don't have easy access to the logging
functionality defined in my Form class.

I realize I've got a flawed design and that my error handling should be
abstracted from the Form class and stand on it's own. How do most of you
handle this? A LogClass with static methods(IE: LogError(), LogWarning(),
etc) or maybe a Singleton class or possibly even passing a LogClass
reference into the c'tor of every class(No!)

If you have any "really clean or slick" solutions, please share.. I'm
spinning my wheels a little at this point.

Thank you,
Steve
 
Steve said:
I have found myself being a bad programmer. I know I should trap errors and
exceptions and log them, but I'm not.... everywhere. I DO when the error
happens in my Form class because that is where I initially setup my error
log. I find now, after adding 30+ classes that when an error happens in
them, I don't do anything because I don't have easy access to the logging
functionality defined in my Form class.

I realize I've got a flawed design and that my error handling should be
abstracted from the Form class and stand on it's own. How do most of you
handle this? A LogClass with static methods(IE: LogError(), LogWarning(),
etc) or maybe a Singleton class or possibly even passing a LogClass
reference into the c'tor of every class(No!)

If you have any "really clean or slick" solutions, please share.. I'm
spinning my wheels a little at this point.

Thank you,
Steve

Delegates are great!
singleton with a delegate to the UI method

everything is great ;)

have a good weekend!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top