From d5d46fd5894b7339532c4f7576c8aa55ce44d285 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Thu, 5 Oct 2006 03:20:59 +0000 Subject: Bug 351175: The WebService interface should include the error text along with the error name Patch By Max Kanat-Alexander r=Wurblzap, a=myk --- Bugzilla/Error.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'Bugzilla/Error.pm') diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index 1bb0556af..95088850e 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -81,16 +81,21 @@ sub _throw_error { $template->process($name, $vars) || ThrowTemplateError($template->error()); } - elsif (Bugzilla->error_mode == ERROR_MODE_DIE) { + else { my $message; $template->process($name, $vars, \$message) || ThrowTemplateError($template->error()); - die("$message\n"); - } - elsif (Bugzilla->error_mode == ERROR_MODE_DIE_SOAP_FAULT) { - die SOAP::Fault - ->faultcode(ERROR_GENERAL) - ->faultstring($error); + if (Bugzilla->error_mode == ERROR_MODE_DIE) { + die("$message\n"); + } + elsif (Bugzilla->error_mode == ERROR_MODE_DIE_SOAP_FAULT) { + my $code = WS_ERROR_CODE->{$error}; + if (!$code) { + $code = ERROR_UNKNOWN_FATAL if $name =~ /code/i; + $code = ERROR_UNKNOWN_TRANSIENT if $name =~ /user/i; + } + die SOAP::Fault->faultcode($code)->faultstring($message); + } } exit; } -- cgit v1.2.3-24-g4f1b