annotate errors.js @ 47:0d3f18bb1d36

Remove usage of fdsq.js in modules.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 10 Mar 2011 16:13:49 +0100
parents 023f767662d3
children 99bd1d1ac071
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 /*
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
2 * Copyright (C) 2010 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
3 *
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4 * This file is part of PSĜS, a PubSub server written in JavaScript.
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
5 *
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
6 * PSĜS is free software: you can redistribute it and/or modify
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
7 * it under the terms of the GNU Affero General Public License as
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
9 * License.
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
10 *
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
11 * PSĜS is distributed in the hope that it will be useful,
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
14 * GNU Affero General Public License for more details.
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
15 *
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
16 * You should have received a copy of the GNU Affero General Public License
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
17 * along with PSĜS. If not, see <http://www.gnu.org/licenses/>.
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
18 */
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
19
43
023f767662d3 Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 40
diff changeset
20 'use strict';
023f767662d3 Fix compatibility with strict mode of node 0.4 and some files without licence header.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 40
diff changeset
21
0
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
22 var errors = exports;
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
23
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
24 errors.success = true;
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
25 errors.feature_not_implemented = {n: 1, type: 'cancel', error: 'feature-not-implemented'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
26 errors.node_does_not_exist = {n: 2, type: 'cancel', error: 'item-not-found'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
27 errors.bad_request = {n: 3, type: 'modify', error: 'bad-request'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
28 errors.nodeid_required = {n: 4, type: 'modify', error: 'bad-request', reason: 'nodeid-required'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
29 errors.itemid_required = {n: 5, type: 'modify', error: 'bad-request', reason: 'item-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
30 errors.forbidden = {n: 6, type: 'auth', error: 'forbidden'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
31 errors.subscriptions_retrieval_not_supported = {n: 23, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'retrieve-subscriptions'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
32 errors.affiliations_retrieval_not_supported = {n: 29, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'retrieve-affiliations'};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
33
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
34 errors.sub = {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
35 subscribe: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
36 jids_do_not_match: {n: 34, type: 'modify', error: 'bad-request', reason: 'invalid-jid'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
37 presence_subscription_required: {n: 35, type: 'auth', error: 'not-authorized', reason: 'presence-subscription-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
38 not_in_roster_group: {n: 36, type: 'auth', error: 'not-authorized', reason: 'not-in-roster-group'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
39 not_on_whitelist: {n: 37, type: 'cancel', error: 'not-allowed', reason: 'closed-node'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
40 payment_required: {n: 38, type: 'auth', error: 'payment-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
41 anonymous_subscriptions_not_allowed: {n: 39, type: 'cancel', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
42 subscription_pending: {n: 40, type: 'auth', error: 'not-authorized', reason: 'pending-subscription'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
43 blocked: {n: 41, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
44 too_many_subscriptions: {n: 42, type: 'wait', error: 'policy-violation', reason: 'too-many-subscriptions'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
45 not_supported: {n: 43, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'subscribe'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
46 node_has_moved: {n: 44, type: 'modify', error: 'gone', text: true},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
47 node_does_not_exist: {n: 45, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
48 configuration_required: {n: 48, type: 'modify', error: 'not-acceptable', reason: 'configuration-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
49 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
50 unsubscribe: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
51 no_subscription_id: {n: 53, type: 'modify', error: 'bad-request', reason: 'subid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
52 no_such_subscriber: {n: 54, type: 'cancel', error: 'unexpected-request', reason: 'not-subscribed'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
53 insufficient_privileges: {n: 55, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
54 node_does_not_exist: {n: 56, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
55 bad_subscription_id: {n: 57, type: 'modify', error: 'not-acceptable', reason: 'invalid-subid'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
56 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
57 configure: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
58 insufficient_privileges: {n: 61, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
59 no_such_subscriber: {n: 62, type: 'modify', error: 'unexpected-request', reason: 'not-subscribed'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
60 subscriber_jid_required: {n: 63, type: 'modify', error: 'bad-request', reason: 'jid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
61 subscription_id_required: {n: 64, type: 'modify', error: 'bad-request', reason: 'subid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
62 invalid_subscription_id: {n: 65, type: 'modify', error: 'not-acceptable', reason: 'invalid-subid'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
63 subscription_options_not_supported: {n: 66, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'subscription-options'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
64 node_does_not_exist: {n: 67, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
65 form_processing_failure: {n: 70, type: 'modify', error: 'bad-request', reason: 'invalid-options'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
66 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
67 default_options: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
68 node_configuration_not_supported: {n: 76, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'subscription-options'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
69 default_subscription_configuration_retrieval_not_supported: {n: 77, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'retrieve-default-sub'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
70 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
71 retrieve: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
72 subscription_id_required: {n: 87, type: 'modify', error: 'bad-request', reason: 'subid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
73 invalid_subscription_id: {n: 88, type: 'modify', error: 'not-acceptable', reason: 'invalid-subid xmlns'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
74 entity_not_subscribed: {n: 89, type: 'auth', error: 'not-authorized', reason: 'not-subscribed'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
75 persistent_items_not_supported: {n: 90, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'persistent-items'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
76 item_retrieval_not_supported: {n: 91, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'retrieve-items'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
77 presence_subscription_required: {n: 92, type: 'auth', error: 'not-authorized', reason: 'presence-subscription-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
78 not_in_roster_group: {n: 93, type: 'auth', error: 'not-authorized', reason: 'not-in-roster-group'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
79 not_on_whitelist: {n: 94, type: 'cancel', error: 'not-allowed', reason: 'closed-node'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
80 payment_required: {n: 95, type: 'auth', error: 'payment-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
81 blocked: {n: 96, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
82 node_does_not_exist: {n: 97, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
83 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
84 };
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
85
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
86 errors.pub = {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
87 publish: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
88 insufficient_privileges: {n: 105, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
89 item_publication_not_supported: {n: 106, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'publish'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
90 node_does_not_exist: {n: 107, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
91 payload_too_big: {n: 108, type: 'modify', error: 'not-acceptable', reason: 'payload-too-big'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
92 bad_payload: {n: 109, type: 'modify', error: 'bad-request', reason: 'invalid-payload'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
93 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
94 configuration: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
95 no_item: {n: 110, type: 'modify', error: 'bad-request', reason: 'item-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
96 no_payload: {n: 111, type: 'modify', error: 'bad-request', reason: 'payload-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
97 transient_item: {n: 112, type: 'modify', error: 'bad-request', reason: 'item-forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
98 precondition: {n: 113, type: 'modify', error: 'conflict', reason: 'precondition-not-met'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
99
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
100 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
101 retract: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
102 insufficient_privileges: {n: 118, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
103 node_does_not_exist: {n: 119, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
104 nodeid_required: {n: 120, type: 'modify', error: 'bad-request', reason: 'nodeid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
105 item_or_itemid_required: {n: 121, type: 'modify', error: 'bad-request', reason: 'item-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
106 persistent_items_not_supported: {n: 122, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'persistent-items'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
107 item_deletion_not_supported: {n: 123, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'delete-items'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
108 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
109 };
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
110
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
111 errors.owner = {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
112 create: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
113 node_creation_not_supported: {n: 125, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'create-nodes'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
114 service_requires_registration: {n: 126, type: 'auth', error: 'registration-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
115 prohibited: {n: 127, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
116 nodeid_already_exists: {n: 128, type: 'cancel', error: 'conflict'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
117 instant_nodes_not_supported: {n: 129, type: 'modify', error: 'not-acceptable', reason: 'nodeid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
118 specified_access_model_not_supported: {n: 135, type: 'modify', error: 'not-acceptable', reason: 'unsupported-access-model'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
119 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
120 configure: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
121 node_configuration_not_supported: {n: 140, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'config-node'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
122 insufficient_privileges: {n: 141, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
123 nodeid_required: {n: 142, type: 'modify', error: 'bad-request', reason: 'nodeid-required'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
124 no_configuration_options: {n: 143, type: 'cancel', error: 'not-allowed'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
125 node_does_not_exist: {n: 144, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
126 form_processing_failure: {n: 148, type: 'modify', error: 'not-acceptable'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
127 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
128 default_options: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
129 node_configuration_not_supported: {n: 153, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'config-node'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
130 default_node_configuration_retrieval_not_supported: {n: 154, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'retrieve-default'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
131 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
132 delete_node: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
133 insufficient_privileges: {n: 159, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
134 node_does_not_exist: {n: 160, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
135 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
136 purge: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
137 node_purging_not_supported: {n: 164, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'purge-nodes'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
138 insufficient_privileges: {n: 165, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
139 node_does_not_persist_items: {n: 166, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'persistent-items'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
140 node_does_not_exist: {n: 167, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
141 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
142 //manage_subscription_requests: {},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
143 pending_subscription_requests: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
144 ad_hoc_commands_not_supported: {n: 176, type: 'cancel', error: 'service-unavailable'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
145 get_pending_not_supported: {n: 177, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'get-pending'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
146 insufficient_privileges: {n: 178, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
147 node_does_not_exist: {n: 179, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
148 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
149 manage_subscriptions: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
150 not_supported: {n: 184, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'manage-subscriptions'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
151 retrieve_list: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
152 entity_is_not_an_owner: {n: 185, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
153 node_does_not_exist: {n: 186, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
154 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
155 modify: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
156 entity_is_not_an_owner: {n: 190, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
157 node_does_not_exist: {n: 191, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
158 multiple_simultaneous_modifications: {n: 193, type: 'modify', error: 'not-acceptable'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
159 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
160 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
161 manage_affiliations: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
162 not_supported: {n: 197, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'modify-affiliations'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
163 retrieve_list: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
164 entity_is_not_an_owner: {n: 198, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
165 node_does_not_exist: {n: 199, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
166 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
167 modify: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
168 requested_affiliation_not_supported: {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
169 publisher: {n: 203, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'publisher-affiliation'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
170 'publish-only': {n: 203, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'publish-only-affiliation'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
171 member: {n: 203, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'member-affiliation'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
172 outcast: {n: 203, type: 'cancel', error: 'feature-not-implemented', reason: 'unsupported', feature: 'outcast-affiliation'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
173 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
174 entity_is_not_an_owner: {n: 204, type: 'auth', error: 'forbidden'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
175 node_does_not_exist: {n: 205, type: 'cancel', error: 'item-not-found'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
176 multiple_simultaneous_modifications: {n: 207, type: 'modify', error: 'not-acceptable'},
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
177 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
178 },
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
179 };
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
180
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
181 var reverse = {};
0
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
182
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
183 (function reverseError(o) {
0
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
184 for (var i in o) {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
185 if (i == 'reverse' || typeof (o[i]) == 'number');
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
186 else if (!o[i].n)
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
187 reverseError(o[i]);
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
188 else {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
189 var k = {};
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
190 for (var j in o[i]) {
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
191 if (j != 'n')
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
192 k[j] = o[i][j];
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
193 }
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
194 reverse[o[i].n] = k;
0
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
195 }
9ee956af41e3 Initial commit
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
196 }
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
197 })(errors);
23
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
198
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
199 exports.makeError = function(response, errorNumber, payload) {
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
200 response.attr.type = 'error';
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
201 if (payload)
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
202 response.cnode(payload);
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
203
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
204 var e = reverse[errorNumber];
23
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
205 response.c('error', {type: e.type});
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
206
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
207 response.c(e.error, {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'}).up();
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
208
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
209 if (e.reason) {
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
210 if (e.feature)
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
211 response.c(e.reason, {xmlns: 'http://jabber.org/protocol/pubsub#errors', feature: e.feature});
23
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
212 else
40
741110cdcfcf Avoid exposing unneeded object.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 23
diff changeset
213 response.c(e.reason, {xmlns: 'http://jabber.org/protocol/pubsub#errors'});
23
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
214 }
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
215
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
216 return response;
5fc4ee90c1bc A lot of refactorization. First attempt to modularize the server.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 0
diff changeset
217 }