aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurblzap%gmail.com <>2006-08-20 00:20:23 +0000
committerwurblzap%gmail.com <>2006-08-20 00:20:23 +0000
commit0ee4621e7828a205189368aa9b8a515574d9c030 (patch)
tree93caacf40fc87a27e224e8fefa6b7284e686e918 /Bugzilla/Error.pm
parentBug 349198: 001compile.t must not compile mod_perl.pl - Patch by Frédéric B... (diff)
downloadbugzilla-0ee4621e7828a205189368aa9b8a515574d9c030.tar.gz
bugzilla-0ee4621e7828a205189368aa9b8a515574d9c030.tar.bz2
bugzilla-0ee4621e7828a205189368aa9b8a515574d9c030.zip
Bug 224577: Bugzilla could use a web services interface.
Patch by Marc Schumann <wurblzap@gmail.com>; r=mkanat; a=myk
Diffstat (limited to 'Bugzilla/Error.pm')
-rw-r--r--Bugzilla/Error.pm20
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");
}