-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy patherror.js
More file actions
126 lines (108 loc) · 3.76 KB
/
error.js
File metadata and controls
126 lines (108 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const idrErr = require('../../utils/error')
class RegistryOrgControllerError extends idrErr.IDRError {
orgDnePathParam (shortname) { // org
const err = {}
err.error = 'ORG_DNE_PARAM'
err.message = `The '${shortname}' organization designated by the shortname path parameter does not exist.`
return err
}
userDne (username) { // org
const err = {}
err.error = 'USER_DNE'
err.message = `The user '${username}' designated by the username parameter does not exist.`
return err
}
notSameOrgOrSecretariat () { // org
const err = {}
err.error = 'NOT_SAME_ORG_OR_SECRETARIAT'
err.message = 'This information can only be viewed by the users of the same organization or the Secretariat.'
return err
}
notAllowedToChangeOrganization () {
const err = {}
err.error = 'NOT_ALLOWED_TO_CHANGE_ORGANIZATION'
err.message = 'Only the Secretariat can change the organization for a user.'
return err
}
orgExists (shortname) { // org
const err = {}
err.error = 'ORG_EXISTS'
err.message = `The '${shortname}' organization already exists.`
return err
}
userExists (username) { // org
const err = {}
err.error = 'USER_EXISTS'
err.message = `The user '${username}' already exists.`
return err
}
uuidProvided (creationType) {
const err = {}
err.error = 'UUID_PROVIDED'
err.message = `Providing UUIDs for ${creationType} creation or update is not allowed.`
return err
}
duplicateUsername (shortname, username) { // org
const err = {}
err.error = 'DUPLICATE_USERNAME'
err.message = `The user could not be updated because the '${shortname}' organization contains another user with the username '${username}'.`
return err
}
alreadyInOrg (shortname, username) { // org
const err = {}
err.error = 'USER_ALREADY_IN_ORG'
err.message = `The user could not be updated because the user '${username}' already belongs to the '${shortname}' organization.`
return err
}
duplicateShortname (shortname) { // org
const err = {}
err.error = 'DUPLICATE_SHORTNAME'
err.message = `The organization cannot be renamed as '${shortname}' because this shortname is used by another organization.`
return err
}
paramDne (param) { // org
const err = {}
err.error = 'BAD_PARAMETER_NAME'
err.message = `'${param}' is not a valid parameter.`
return err
}
notAllowedToSelfDemote () {
const err = {}
err.error = 'NOT_ALLOWED_TO_SELF_DEMOTE'
err.message = 'Please have another admin user from your organization change your role.'
return err
}
userLimitReached () {
const err = {}
err.error = 'NUMBER_OF_USERS_IN_ORG_LIMIT_REACHED'
err.message = 'The requested user can not be created and added to the organization because the organization has hit its limit of 100 users. Contact the Secretariat.'
return err
}
conversationDne (shortname, index) {
const err = {}
err.error = 'CONVERSATION_DNE'
err.message = `The conversation at index ${index} does not exist for the ${shortname} organization.`
return err
}
notAllowedToEditConversation () {
const err = {}
err.error = 'NOT_ALLOWED_TO_EDIT_CONVERSATION'
err.message = 'You must be the original author or Secretariat to edit this conversation.'
return err
}
notAllowedToChangeConversationVisibility () {
const err = {}
err.error = 'NOT_ALLOWED_TO_CHANGE_CONVERSATION_VISIBILITY'
err.message = 'Only the Secretariat is allowed to change the visibility of a conversation.'
return err
}
invalidConversationObject () {
const err = {}
err.error = 'BAD_INPUT'
err.message = 'Parameters were invalid: conversation must be an object with a body.'
return err
}
}
module.exports = {
RegistryOrgControllerError
}