Automatically forward errors via email

I want to run code inside my program that will record and send any error that occurs whether handled or not to me via email or some other method , but especially not handled... can you point me in a direction of and example
dolamitejenkinsAsked:
Who is Participating?
 
mish33Connect With a Mentor Commented:
Wrap your main function - it will catch all exceptions (in the main thread) in all modules.
0
 
mish33Commented:
Use try/except :
def myfunc():
  # to do something useful

try :
  myfunc()
except :
  # mail error
  sendmail(sys.exc_info())

Open in new window

0
 
dolamitejenkinsAuthor Commented:
my program is about 2000 lines ... when people start using it How can I collect all the error that occur ... this seems to capture for one module... any thoughts ?
0
 
dolamitejenkinsAuthor Commented:
Thanks
0
 
dolamitejenkinsAuthor Commented:
thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.