How to trap program crashes with HTTP error code 500

不问归期 提交于 2019-12-12 06:38:36

问题


I have a number of badly written perl programs serving up my websites. Occasionally they crash and the user sees ...

Software error: Yadda yadda yadda. For help, please send mail to the webmaster (webmaster@mywebsite.com), giving this error message and the time and date of the error.

I don't have access to that email address and even if I did those naughty users cannot be trusted to report this error.

So what I would like to do is get this error to trigger a HTTP error 500, so that I can monitor it with a line in the htaccess file like ...

ErrorDocument 500 /fixThisBug.shtml


回答1:


Thanks to ThisSuitIsBlackNot for the direction.

The perl programs all have

use CGI::Carp(fatalsToBrowser);

Which stifles the HTTP 500 error. Simply removing this will allow the programs to crash "properly".



来源:https://stackoverflow.com/questions/42014643/how-to-trap-program-crashes-with-http-error-code-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!