From b9543e48f33729c4a4560eac2a856af06ed9e9d5 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 10 Nov 2014 16:08:13 +0000 Subject: Bug 1094858: Create hook in Bugzilla::WebService::Constants to allow overrriding of standard status codes by extensions r=gerv,a=glob --- extensions/Example/Extension.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'extensions/Example') 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) = @_; -- cgit v1.2.3-24-g4f1b