summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Error.pm
diff options
context:
space:
mode:
authorwurblzap%gmail.com <>2006-08-20 02:20:23 +0200
committerwurblzap%gmail.com <>2006-08-20 02:20:23 +0200
commit0ee4621e7828a205189368aa9b8a515574d9c030 (patch)
tree93caacf40fc87a27e224e8fefa6b7284e686e918 /Bugzilla/Error.pm
parent79c7d0e961d9adf2c3a0459594745afb41b19e4c (diff)
downloadbugzilla-0ee4621e7828a205189368aa9b8a515574d9c030.tar.gz
bugzilla-0ee4621e7828a205189368aa9b8a515574d9c030.tar.xz
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");
}