]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 554714: Make JSON-RPC throw errors properly even if they are thrown
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Thu, 1 Apr 2010 01:06:03 +0000 (18:06 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Thu, 1 Apr 2010 01:06:03 +0000 (18:06 -0700)
before method evaluation (like during checking of Bugzilla_login and
Bugzilla_password)
r=dkl, a=mkanat

Bugzilla/Error.pm

index 98e7d1d2fac92d26d4b53dbe599723e0f6bef44b..0c471125dde82b502d3c5c87d36260a3f5947d87 100644 (file)
@@ -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);
             }
         }
     }