~ubuntu-branches/debian/squeeze/bugzilla/squeeze

« back to all changes in this revision

Viewing changes to Bugzilla/WebService/Constants.pm

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Bossek
  • Date: 2008-06-27 22:34:34 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080627223434-0ib57vstn43bb4a3
Tags: 3.0.4.1-1
* Update of French, Russian and German translations. (closes: #488251)
* Added Bulgarian and Belarusian translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
18
 
package Bugzilla::WebService::Constants;
19
 
 
20
 
use strict;
21
 
use base qw(Exporter);
22
 
 
23
 
@Bugzilla::WebService::Constants::EXPORT = qw(
24
 
    WS_ERROR_CODE
25
 
    ERROR_UNKNOWN_FATAL
26
 
    ERROR_UNKNOWN_TRANSIENT
27
 
 
28
 
    ERROR_AUTH_NODATA
29
 
    ERROR_UNIMPLEMENTED
30
 
 
31
 
    LOGIN_EXEMPT
32
 
);
33
 
 
34
 
# This maps the error names in global/*-error.html.tmpl to numbers.
35
 
# Generally, transient errors should have a number above 0, and
36
 
# fatal errors should have a number below 0.
37
 
#
38
 
# This hash should generally contain any error that could be thrown
39
 
# by the WebService interface. If it's extremely unlikely that the
40
 
# error could be thrown (like some CodeErrors), it doesn't have to
41
 
# be listed here.
42
 
#
43
 
# "Transient" means "If you resubmit that request with different data,
44
 
# it may work."
45
 
#
46
 
# "Fatal" means, "There's something wrong with Bugzilla, probably
47
 
# something an administrator would have to fix."
48
 
#
49
 
# NOTE: Numbers must never be recycled. If you remove a number, leave a
50
 
# comment that it was retired. Also, if an error changes its name, you'll
51
 
# have to fix it here.
52
 
use constant WS_ERROR_CODE => {
53
 
    # Bug errors usually occupy the 100-200 range.
54
 
    invalid_bug_id_or_alias     => 100,
55
 
    invalid_bug_id_non_existent => 101,
56
 
    bug_access_denied           => 102,
57
 
    bug_access_query            => 102,
58
 
    invalid_field_name          => 108,
59
 
    # These all mean "invalid alias"
60
 
    alias_not_defined        => 103,
61
 
    alias_too_long           => 103,
62
 
    alias_in_use             => 103,
63
 
    alias_is_numeric         => 103,
64
 
    alias_has_comma_or_space => 103,
65
 
    # Misc. bug field errors
66
 
    illegal_field => 104,
67
 
    freetext_too_long => 104,
68
 
    # Component errors
69
 
    require_component       => 105,
70
 
    component_name_too_long => 105,
71
 
    component_not_valid     => 105,
72
 
    # Invalid Product
73
 
    no_products         => 106,
74
 
    entry_access_denied => 106,
75
 
    product_access_denied => 106,
76
 
    product_disabled    => 106,
77
 
    # Invalid Summary
78
 
    require_summary => 107,
79
 
 
80
 
    # Authentication errors are usually 300-400.
81
 
    invalid_username_or_password => 300,
82
 
    account_disabled             => 301,
83
 
    auth_invalid_email           => 302,
84
 
    extern_id_conflict           => -303,
85
 
 
86
 
    # User errors are 500-600.
87
 
    account_exists        => 500,
88
 
    illegal_email_address => 501,
89
 
    account_creation_disabled   => 501,
90
 
    password_too_short    => 502,
91
 
    password_too_long     => 503,
92
 
    invalid_username      => 504,
93
 
    # This is from strict_isolation, but it also basically means 
94
 
    # "invalid user."
95
 
    invalid_user_group    => 504,
96
 
};
97
 
 
98
 
# These are the fallback defaults for errors not in ERROR_CODE.
99
 
use constant ERROR_UNKNOWN_FATAL     => -32000;
100
 
use constant ERROR_UNKNOWN_TRANSIENT => 32000;
101
 
 
102
 
use constant ERROR_AUTH_NODATA   => 410;
103
 
use constant ERROR_UNIMPLEMENTED => 910;
104
 
use constant ERROR_GENERAL       => 999;
105
 
 
106
 
# For some methods, we shouldn't call Bugzilla->login before we call them.
107
 
# This is a hash--package names pointing to an arrayref of method names.
108
 
use constant LOGIN_EXEMPT => {
109
 
    # Callers may have to know the Bugzilla version before logging in,
110
 
    # even on a requirelogin installation.
111
 
    Bugzilla => ['version', 'timezone'],
112
 
    User     => ['offer_account_by_email', 'login'],
113
 
};
114
 
 
115
 
1;