From: Max Kanat-Alexander Date: Thu, 1 Apr 2010 01:06:03 +0000 (-0700) Subject: Bug 554714: Make JSON-RPC throw errors properly even if they are thrown X-Git-Tag: bugzilla-3.6~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57522a24a4ea2ad5596646fd6837d5ba84589f38;p=thirdparty%2Fbugzilla.git Bug 554714: Make JSON-RPC throw errors properly even if they are thrown before method evaluation (like during checking of Bugzilla_login and Bugzilla_password) r=dkl, a=mkanat --- diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index 98e7d1d2fa..0c471125dd 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -127,9 +127,12 @@ sub _throw_error { message => $message, id => $server->{_bz_request_id}, version => $server->version); - # We die with no message. JSON::RPC checks raise_error before + # Most JSON-RPC Throw*Error calls happen within an eval inside + # of JSON::RPC. So, in that circumstance, instead of exiting, + # we die with no message. JSON::RPC checks raise_error before # it checks $@, so it returns the proper error. - die; + die if _in_eval(); + $server->response($server->error_response_header); } } }