From 11e17befd5f484859eea97b5bf831d220ce2b2a8 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Wed, 31 Mar 2010 18:05:14 -0700 Subject: 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 --- Bugzilla/Error.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index 98e7d1d2f..0c471125d 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); } } } -- cgit v1.2.3-24-g4f1b