summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BzAPI/Extension.pm7
-rw-r--r--extensions/Example/Extension.pm12
2 files changed, 18 insertions, 1 deletions
diff --git a/extensions/BzAPI/Extension.pm b/extensions/BzAPI/Extension.pm
index cd08369b0..e6159243a 100644
--- a/extensions/BzAPI/Extension.pm
+++ b/extensions/BzAPI/Extension.pm
@@ -17,6 +17,7 @@ use Bugzilla::Error;
use Bugzilla::Util qw(trick_taint datetime_from);
use Bugzilla::Constants;
use Bugzilla::Install::Filesystem;
+use Bugzilla::WebService::Constants;
use File::Basename;
@@ -169,6 +170,12 @@ sub webservice_rest_resources {
_add_resources($rpc, $resources);
}
+sub webservice_status_code_map {
+ my ($self, $args) = @_;
+ my $status_code_map = $args->{status_code_map};
+ $status_code_map->{51} = STATUS_BAD_REQUEST;
+}
+
#####################
# Utility Functions #
#####################
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm
index a42f87b9e..5b76935e3 100644
--- a/extensions/Example/Extension.pm
+++ b/extensions/Example/Extension.pm
@@ -32,6 +32,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.
@@ -950,11 +951,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) = @_;