summaryrefslogtreecommitdiffstats
path: root/extensions/Example
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-11-10 17:08:13 +0100
committerDavid Lawrence <dkl@mozilla.com>2014-11-10 17:08:13 +0100
commitb9543e48f33729c4a4560eac2a856af06ed9e9d5 (patch)
tree4db2a797fc4f138a74ad09551b273bcf1b61785b /extensions/Example
parent41dbccc20f013f0b06959ad587f5fb6ac4813686 (diff)
downloadbugzilla-b9543e48f33729c4a4560eac2a856af06ed9e9d5.tar.gz
bugzilla-b9543e48f33729c4a4560eac2a856af06ed9e9d5.tar.xz
Bug 1094858: Create hook in Bugzilla::WebService::Constants to allow overrriding of standard status codes by extensions
r=gerv,a=glob
Diffstat (limited to 'extensions/Example')
-rw-r--r--extensions/Example/Extension.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm
index 256589dab..af36b107a 100644
--- a/extensions/Example/Extension.pm
+++ b/extensions/Example/Extension.pm
@@ -21,6 +21,7 @@ use Bugzilla::User::Setting;
use Bugzilla::Util qw(diff_arrays html_quote);
use Bugzilla::Status qw(is_open_state);
use Bugzilla::Install::Filesystem;
+use Bugzilla::WebService::Constants;
# This is extensions/Example/lib/Util.pm. I can load this here in my
# Extension.pm only because I have a Config.pm.
@@ -958,11 +959,20 @@ sub webservice {
sub webservice_error_codes {
my ($self, $args) = @_;
-
+
my $error_map = $args->{error_map};
$error_map->{'example_my_error'} = 10001;
}
+sub webservice_status_code_map {
+ my ($self, $args) = @_;
+
+ my $status_code_map = $args->{status_code_map};
+ # Uncomment this line to override the status code for the
+ # error 'object_does_not_exist' to STATUS_BAD_REQUEST
+ #$status_code_map->{51} = STATUS_BAD_REQUEST;
+}
+
sub webservice_before_call {
my ($self, $args) = @_;