diff options
author | mkanat%bugzilla.org <> | 2006-10-05 05:20:59 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2006-10-05 05:20:59 +0200 |
commit | d5d46fd5894b7339532c4f7576c8aa55ce44d285 (patch) | |
tree | 34cfaa94ec279694af26e426e965996895000865 /Bugzilla/WebService | |
parent | 8d5dd5786873437f9fa840679cd94172e8ca30f1 (diff) | |
download | bugzilla-d5d46fd5894b7339532c4f7576c8aa55ce44d285.tar.gz bugzilla-d5d46fd5894b7339532c4f7576c8aa55ce44d285.tar.xz |
Bug 351175: The WebService interface should include the error text along with the error name
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=Wurblzap, a=myk
Diffstat (limited to 'Bugzilla/WebService')
-rwxr-xr-x | Bugzilla/WebService/Constants.pm | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm index 2e9457add..f9728e246 100755 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -13,6 +13,7 @@ # The Original Code is the Bugzilla Bug Tracking System. # # Contributor(s): Marc Schumann <wurblzap@gmail.com> +# Max Kanat-Alexander <mkanat@bugzilla.org> package Bugzilla::WebService::Constants; @@ -20,11 +21,49 @@ use strict; use base qw(Exporter); @Bugzilla::WebService::Constants::EXPORT = qw( + WS_ERROR_CODE + ERROR_UNKNOWN_FATAL + ERROR_UNKNOWN_TRANSIENT + ERROR_AUTH_NODATA ERROR_UNIMPLEMENTED - ERROR_GENERAL ); +# This maps the error names in global/*-error.html.tmpl to numbers. +# Generally, transient errors should have a number above 0, and +# fatal errors should have a number below 0. +# +# This hash should generally contain any error that could be thrown +# by the WebService interface. If it's extremely unlikely that the +# error could be thrown (like some CodeErrors), it doesn't have to +# be listed here. +# +# "Transient" means "If you resubmit that request with different data, +# it may work." +# +# "Fatal" means, "There's something wrong with Bugzilla, probably +# something an administrator would have to fix." +# +# NOTE: Numbers must never be recycled. If you remove a number, leave a +# comment that it was retired. Also, if an error changes its name, you'll +# have to fix it here. +use constant WS_ERROR_CODE => { + # Bug errors usually occupy the 100-200 range. + invalid_bug_id_or_alias => 100, + invalid_bug_id_non_existent => 101, + bug_access_denied => 102, + + # Authentication errors are usually 300-400. + invalid_username_or_password => 300, + account_disabled => 301, + auth_invalid_email => 302, + extern_id_conflict => -303, +}; + +# These are the fallback defaults for errors not in ERROR_CODE. +use constant ERROR_UNKNOWN_FATAL => -32000; +use constant ERROR_UNKNOWN_TRANSIENT => 32000; + use constant ERROR_AUTH_NODATA => 410; use constant ERROR_UNIMPLEMENTED => 910; use constant ERROR_GENERAL => 999; |