# Exceptions automatically emailed

**URL:** <https://www.ruby-forum.com/t/exceptions-automatically-emailed/87667>\
**Category:** Ruby\
**Created:** [March 5, 2007, 1:54am UTC](https://www.ruby-forum.com/t/exceptions-automatically-emailed/87667 "2007-03-05T01:54:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nappin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f475e1/32.png) [@nappin](https://www.ruby-forum.com/u/nappin)\
**Post date:** [March 5, 2007, 1:54am UTC](https://www.ruby-forum.com/t/exceptions-automatically-emailed/87667/1 "2007-03-05T01:54:26Z")

</div>

Hi,  
I was wondering if there is a way to override the Exception class so  
that any exception is automatically emailed using my email library.  
Right now I just do it in rescue blocks, but it would be useful to me if  
I could just have it done automatically if an exception is raised  
anywhere in my program. Is there any way to do this? Several months  
ago someone asked a similar question and suggested overriding  
Exception#set\_backtrace, but wasn’t sure if there was a better way to do  
it. Is this the best way to do it?

If so, where do I find the original code for set\_backtrace? I see it on  
the web but it is in C so I’m confused how I would modify that.  
Thanks,  
Ray
