[Dancer-users] Saving/Emailing debug information on "die" in production
Assaf Gordon
gordon at cshl.edu
Fri Jul 27 16:59:26 CEST 2012
Alex C wrote, On 07/27/2012 09:39 AM:
> On 26 July 2012 16:22, Assaf Gordon <gordon at cshl.edu> wrote:
>>
>> but is there a way to save the information to a file, or better yet - email it to someone ?
>>
>
> You can create a Dancer::Error instance and send it wherever you want:
>
> get '/' => sub {
> eval { die };
> if ($@) {
> my $error = Dancer::Error->new(
> code => 500,
> message => "Died..."
> );
> send_email( $error->render );
> return send_error;
> }
> };
I was hoping for something automatic that will work on any "die" without changing my code between development and production modes.
using "after_error_render" hook (as suggested to me in a private email) doesn't work either, because when "show_errors" is disabled, the "$response" object points to the generic HTML error page, not to the nice stack-trace rendered HTML page.
-gordon
More information about the Dancer-users
mailing list