diff options
Diffstat (limited to 'Bugzilla/Error.pm')
-rw-r--r-- | Bugzilla/Error.pm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index b88c4eeb8..1bb0556af 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -18,6 +18,7 @@ # Rights Reserved. # # Contributor(s): Bradley Baetz <bbaetz@acm.org> +# Marc Schumann <wurblzap@gmail.com> package Bugzilla::Error; @@ -27,6 +28,7 @@ use base qw(Exporter); @Bugzilla::Error::EXPORT = qw(ThrowCodeError ThrowTemplateError ThrowUserError); use Bugzilla::Constants; +use Bugzilla::WebService::Constants; use Bugzilla::Util; use Date::Format; @@ -74,15 +76,21 @@ sub _throw_error { } my $template = Bugzilla->template; - if (Bugzilla->batch) { + if (Bugzilla->error_mode == ERROR_MODE_WEBPAGE) { + print Bugzilla->cgi->header(); + $template->process($name, $vars) + || ThrowTemplateError($template->error()); + } + elsif (Bugzilla->error_mode == ERROR_MODE_DIE) { my $message; $template->process($name, $vars, \$message) || ThrowTemplateError($template->error()); die("$message\n"); - } else { - print Bugzilla->cgi->header(); - $template->process($name, $vars) - || ThrowTemplateError($template->error()); + } + elsif (Bugzilla->error_mode == ERROR_MODE_DIE_SOAP_FAULT) { + die SOAP::Fault + ->faultcode(ERROR_GENERAL) + ->faultstring($error); } exit; } @@ -103,7 +111,7 @@ sub ThrowTemplateError { Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT); my $vars = {}; - if (Bugzilla->batch) { + if (Bugzilla->error_mode == ERROR_MODE_DIE) { die("error: template error: $template_err"); } |