[dancer-users] Automatic JSON serializer breaks error page

Warren Young warren at etr-usa.com
Fri Mar 14 00:57:04 GMT 2014


Apparently you cannot have both

    serializer: "JSON"
    show_errors: 1

in your config.yml.  Enabling the automatic JSON serializer defeats the 
error screen, returning the exception error object as JSON to the client:

{
    "exception" : "Text::Xslate: LoadError: Cannot find 'foo.tx' (path: 
/home/bla/qux) at 
/usr/lib/perl5/site_perl/5.8.8/Dancer/Template/Xslate.pm line 52.\n",
    "error" : "Text::Xslate: LoadError: Cannot find 'foo.tx' (path: 
/home/bla/qux) at 
/usr/lib/perl5/site_perl/5.8.8/Dancer/Template/Xslate.pm line 52.\n"
}

Is there a way I can fix this without going back to manual JSON 
encoding?  (i.e. Setting content_type('application/json') and using 
to_json() on objects in route handlers.)


More information about the dancer-users mailing list