From 01076cee38eb2a5b806e62e62c945cd2c71bfae1 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 13 Jun 2012 13:08:01 +0800 Subject: Fix arecibo handler doubling error messages --- Bugzilla/Error.pm | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index 2114bba47..e49f466d6 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -95,6 +95,20 @@ sub _throw_error { my $template = Bugzilla->template; my $message; + # There are some tests that throw and catch a lot of errors, + # and calling $template->process over and over for those errors + # is too slow. So instead, we just "die" with a dump of the arguments. + if (Bugzilla->error_mode != ERROR_MODE_TEST) { + $template->process($name, $vars, \$message) + || ThrowTemplateError($template->error()); + } + + # Let's call the hook first, so that extensions can override + # or extend the default behavior, or add their own error codes. + require Bugzilla::Hook; + Bugzilla::Hook::process('error_catch', { error => $error, vars => $vars, + message => \$message }); + if (Bugzilla->error_mode == ERROR_MODE_WEBPAGE) { if (arecibo_should_notify($vars->{error})) { $vars->{maintainers_notified} = 1; @@ -113,25 +127,6 @@ sub _throw_error { $vars->{error}, $vars->{processed}->{error_message}, $vars->{uid}); } } - - # There are some tests that throw and catch a lot of errors, - # and calling $template->process over and over for those errors - # is too slow. So instead, we just "die" with a dump of the arguments. - if (Bugzilla->error_mode != ERROR_MODE_TEST) { - $template->process($name, $vars, \$message) - || ThrowTemplateError($template->error()); - } - - # Let's call the hook first, so that extensions can override - # or extend the default behavior, or add their own error codes. - require Bugzilla::Hook; - Bugzilla::Hook::process('error_catch', { error => $error, vars => $vars, - message => \$message }); - - if (Bugzilla->error_mode == ERROR_MODE_WEBPAGE) { - print Bugzilla->cgi->header(); - print $message; - } elsif (Bugzilla->error_mode == ERROR_MODE_TEST) { die Dumper($vars); } -- cgit v1.2.3-24-g4f1b