Constants.pm 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # -*- Mode: perl; indent-tabs-mode: nil -*-
  2. #
  3. # The contents of this file are subject to the Mozilla Public
  4. # License Version 1.1 (the "License"); you may not use this file
  5. # except in compliance with the License. You may obtain a copy of
  6. # the License at http://www.mozilla.org/MPL/
  7. #
  8. # Software distributed under the License is distributed on an "AS
  9. # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10. # implied. See the License for the specific language governing
  11. # rights and limitations under the License.
  12. #
  13. # The Original Code is the Bugzilla Bug Tracking System.
  14. #
  15. # Contributor(s): Marc Schumann <wurblzap@gmail.com>
  16. # Max Kanat-Alexander <mkanat@bugzilla.org>
  17. package Bugzilla::WebService::Constants;
  18. use strict;
  19. use base qw(Exporter);
  20. @Bugzilla::WebService::Constants::EXPORT = qw(
  21. WS_ERROR_CODE
  22. ERROR_UNKNOWN_FATAL
  23. ERROR_UNKNOWN_TRANSIENT
  24. ERROR_AUTH_NODATA
  25. ERROR_UNIMPLEMENTED
  26. );
  27. # This maps the error names in global/*-error.html.tmpl to numbers.
  28. # Generally, transient errors should have a number above 0, and
  29. # fatal errors should have a number below 0.
  30. #
  31. # This hash should generally contain any error that could be thrown
  32. # by the WebService interface. If it's extremely unlikely that the
  33. # error could be thrown (like some CodeErrors), it doesn't have to
  34. # be listed here.
  35. #
  36. # "Transient" means "If you resubmit that request with different data,
  37. # it may work."
  38. #
  39. # "Fatal" means, "There's something wrong with Bugzilla, probably
  40. # something an administrator would have to fix."
  41. #
  42. # NOTE: Numbers must never be recycled. If you remove a number, leave a
  43. # comment that it was retired. Also, if an error changes its name, you'll
  44. # have to fix it here.
  45. use constant WS_ERROR_CODE => {
  46. # Generic Bugzilla::Object errors are 50-99.
  47. object_name_not_specified => 50,
  48. param_required => 50,
  49. object_does_not_exist => 51,
  50. # Error 52 exists only in later releases.
  51. param_invalid => 53,
  52. # Bug errors usually occupy the 100-200 range.
  53. improper_bug_id_field_value => 100,
  54. bug_id_does_not_exist => 101,
  55. bug_access_denied => 102,
  56. bug_access_query => 102,
  57. # These all mean "invalid alias"
  58. alias_too_long => 103,
  59. alias_in_use => 103,
  60. alias_is_numeric => 103,
  61. alias_has_comma_or_space => 103,
  62. # Misc. bug field errors
  63. illegal_field => 104,
  64. freetext_too_long => 104,
  65. # Component errors
  66. require_component => 105,
  67. component_name_too_long => 105,
  68. # Invalid Product
  69. no_products => 106,
  70. entry_access_denied => 106,
  71. product_access_denied => 106,
  72. product_disabled => 106,
  73. # Invalid Summary
  74. require_summary => 107,
  75. # Invalid field name
  76. invalid_field_name => 108,
  77. # Not authorized to edit the bug
  78. product_edit_denied => 109,
  79. # Authentication errors are usually 300-400.
  80. invalid_username_or_password => 300,
  81. account_disabled => 301,
  82. auth_invalid_email => 302,
  83. extern_id_conflict => -303,
  84. # User errors are 500-600.
  85. account_exists => 500,
  86. illegal_email_address => 501,
  87. account_creation_disabled => 501,
  88. account_creation_restricted => 501,
  89. password_too_short => 502,
  90. password_too_long => 503,
  91. invalid_username => 504,
  92. # This is from strict_isolation, but it also basically means
  93. # "invalid user."
  94. invalid_user_group => 504,
  95. };
  96. # These are the fallback defaults for errors not in ERROR_CODE.
  97. use constant ERROR_UNKNOWN_FATAL => -32000;
  98. use constant ERROR_UNKNOWN_TRANSIENT => 32000;
  99. use constant ERROR_AUTH_NODATA => 410;
  100. use constant ERROR_UNIMPLEMENTED => 910;
  101. use constant ERROR_GENERAL => 999;
  102. 1;