[Dancer-users] Invalid content-type sended by dancer when error 500 happens

sawyer x xsawyerx at gmail.com
Sat Mar 24 12:16:08 CET 2012


On Sat, Mar 17, 2012 at 7:04 PM, Tomasz Konojacki <xenu at poczta.onet.pl>wrote:

> Also, could someone confirm this problem? I want to know whether it is
> happening to just me.
>

Hi. I'm sorry to have this topic delayed for a week now.

Basically by "die()"ing, you're forcing the perl interpreter to close.
You're providing a bad result to the web server by shutting off the app,
and you're returning the exit code of die() to the user. In effect if you
were to save the result to a file, you'll get a 500 error page. The reason
you're not getting this in an actual proper html output and instead get it
in x-www-form-urlencode, I believe is because you're crashing the app.

This is why "die()" should never be used in *any* web application
(Dancer/Catalyst/CGI/etc.). You should instead use whatever the web
application provides you with in order to halt the requests properly and
return an error to the user.

You should look at Dancer's exception system, or return an html with the
problem.
S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20120324/c74ee5b8/attachment.htm>


More information about the Dancer-users mailing list