From 871de5e2dbb48867b08371ce90881d8f85b18ff1 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 20 Jan 2016 21:53:45 +0000 Subject: Bug 1240029 - The REST API doesn't work correctly with mod_perl r=dylan --- Bugzilla/API/1_0/Server.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Bugzilla/API/1_0') diff --git a/Bugzilla/API/1_0/Server.pm b/Bugzilla/API/1_0/Server.pm index 743af59a1..627da1e58 100644 --- a/Bugzilla/API/1_0/Server.pm +++ b/Bugzilla/API/1_0/Server.pm @@ -211,12 +211,18 @@ sub _handle { my $method = $self->method_name; my $controller = $self->controller; my $params = Bugzilla->input_params; + my $cache = Bugzilla->request_cache; unless ($controller->can($method)) { return $self->return_error(302, "No such a method : '$method'."); } - my $result = eval q| $controller->$method($params) |; + # Let Bugzilla::Error know we are inside an eval() for exceptions + $cache->{in_eval} = 1; + my $result = eval { $controller->$method($params) }; + $cache->{in_eval} = 0; + + return $self->return_error if $self->return_error; if ($@) { return $self->return_error(500, "Procedure error: $@"); -- cgit v1.2.3-24-g4f1b