thiagocavaloti / recaptcha

Automatically exported from code.google.com/p/recaptcha
0 stars 0 forks source link

Fail gracefully instead of calling die() #148

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When the library encounters a problem, it calls die(), breaking whatever web 
site is using the library. It would be better if it would throw an error, 
return FALSE, or some other safe behavior that can be handled by the program 
using the library.

Original issue reported on code.google.com by liam.mor...@gmail.com on 16 Aug 2012 at 6:25

GoogleCodeExporter commented 9 years ago
The attached patch causes recaptchalib.php to return FALSE instead of die()ing.

Original comment by liam.mor...@gmail.com on 20 Aug 2012 at 6:04

Attachments:

GoogleCodeExporter commented 9 years ago
I was about to make a similar suggestion, after seeing my live site die with a 
"Could not open socket" error (temporary network problem, I can only assume).

I too want it to return FALSE instead of die(). But I feel there should be a 
way to retrieve the error message still.
Iw ould say the solution is to turn it into a proper class, and set an 
error_message field which can be retrieved. The library is all a bit procedural 
at the moment

Original comment by p.chapma...@gmail.com on 23 Mar 2013 at 4:49

GoogleCodeExporter commented 9 years ago
I agree; making a proper class that throws errors would be the best way to do 
this. I see the fix that I gave as a quick fix.

Original comment by liam.mor...@gmail.com on 29 Mar 2013 at 4:42