From: Josh Cheek Date: 2013-07-06T22:35:23+09:00 Subject: Re: How do I rescue a program exception in an at_exit block? --001a11c26a300745d204e0d7e0b3 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jul 6, 2013 at 8:32 AM, Josh Cheek wrote: > On Sat, Jul 6, 2013 at 5:27 AM, Robert Klemme wrote: > >> >> >> On Fri, Jul 5, 2013 at 4:08 PM, Josh Cheek wrote: >> >>> I was thinking about how bad I am at reading error messages, and >>> realized it could be useful to catch the exception and write it in a way >>> that was easier for me to find the relevant information. So, came up with >>> this proof of concept: >>> >> >> But why go through those hoops and do it in at_exit? You could simply >> put "begin rescue end" around your main script. >> >> > I like the idea that I could just require a gem and have my error output > changed. > > Also, some cases it's not clear how to do this. Say I wanted to put it in a Rails app, that I run with the shotgun gem. The main script is in code I don't control. -Josh --001a11c26a300745d204e0d7e0b3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sat, Jul 6, 2013 at 8:32 AM, Josh Cheek <josh.cheek@gmail.com>= ; wrote:
On Sat, Jul 6, 2013 at 5:27 AM, Robert Klemme <shortcutter@googlemail.com> wrote:


On Fri, Jul 5, 2013 at 4:08 PM, Josh Cheek <<= a href=3D"mailto:josh.cheek@gmail.com" target=3D"_blank">josh.cheek@gmail.c= om> wrote:
I was thinking about how bad I am at re= ading error messages, and realized it could be useful to catch the exceptio= n and write it in a way that was easier for me to find the relevant informa= tion. So, came up with this proof of concept:

But why go through those hoops and d= o it in at_exit? =A0You could simply put "begin rescue end" aroun= d your main script.


I like the idea that I could just require a gem and ha= ve my error output changed.


Al= so, some cases it's not clear how to do this. Say I wanted to put it in= a Rails app, that I run with the shotgun gem. The main script is in code I= don't control.

-Josh
--001a11c26a300745d204e0d7e0b3--