-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_code.rb
More file actions
110 lines (104 loc) · 8.77 KB
/
Copy patherror_code.rb
File metadata and controls
110 lines (104 loc) · 8.77 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
# frozen_string_literal: true
class ErrorCode
class InvalidErrorCode < StandardError
end
def self.validate_error_code!(error_code)
return unless error_code.is_a?(Symbol)
return if Rails.env.production?
raise InvalidErrorCode, error_code unless error_codes.include?(error_code)
end
# rubocop:disable Layout/LineLength -- To keep readability of the error codes
def self.error_codes
{
missing_permission: { description: 'The user is not permitted to perform this operation' },
missing_parameter: { description: 'Not all required parameters are present' },
cannot_remove_last_administrator: { description: 'This action would remove the last administrator' },
cannot_remove_last_admin_ability: { description: 'This action would remove the last administrative ability' },
cannot_delete_last_admin_role: { description: 'This action would remove the last administrative role' },
inconsistent_namespace: { description: 'Resources are from different namespaces' },
runtime_mismatch: { description: 'Resources are from different runtimes' },
generic_key_not_found: { description: 'The given key was not found in the data type' },
no_primary_runtime: { description: 'The project does not have a primary runtime' },
is_primary_runtime: { description: 'This runtime is the primary runtime of a project' },
invalid_external_identity: { description: 'This external identity is invalid' },
external_identity_does_not_exist: { description: 'This external identity does not exist' },
identity_validation_failed: { description: 'Failed to validate the external identity' },
missing_identity_data: { description: 'This external identity is missing data' },
registration_disabled: { description: 'Self-registration is disabled' },
mfa_failed: { description: 'Invalid MFA data provided' },
mfa_required: { description: 'MFA is required' },
invalid_login_data: { description: 'Invalid login data provided' },
totp_secret_already_set: { description: 'This user already has TOTP set up' },
invalid_totp_secret: { description: 'The TOTP secret is invalid or cannot be verified' },
wrong_totp: { description: 'Invalid TOTP code provided' },
invalid_verification_code: { description: 'Invalid verification code provided' },
email_verification_send_failed: { description: 'Failed to send the email verification' },
unmodifiable_field: { description: 'The user is not permitted to modify this field' },
failed_to_invalidate_old_backup_codes: { description: 'The old backup codes could not be deleted' },
failed_to_save_valid_backup_code: { description: 'The new backup codes could not be saved' },
invalid_setting: { description: 'Invalid setting provided' },
invalid_user: { description: 'The user is invalid because of active model errors' },
invalid_user_organization_pin: { description: 'The user organization pin is invalid because of active model errors' },
invalid_password_repeat: { description: 'The provided password repeat does not match the password' },
cannot_modify_admin: { description: 'Only administrators can modify admin status of users' },
cannot_modify_own_admin: { description: 'Users cannot modify their own admin status' },
user_not_found: { description: 'The user with the given identifier was not found' },
invalid_user_identity: { description: 'The user identity is invalid because of active model errors' },
invalid_user_session: { description: 'The user session is invalid because of active model errors' },
invalid_runtime: { description: 'The runtime is invalid because of active model errors' },
invalid_organization: { description: 'The organization is invalid because of active model errors' },
invalid_namespace_role: { description: 'The namespace role is invalid because of active model errors' },
invalid_namespace_project: { description: 'The namespace project is invalid because of active model errors' },
failed_to_reset_password: { description: 'Failed to reset the user password' },
loading_identity_failed: { description: 'Failed to load user identity from external provider' },
invalid_flow_setting: { description: 'The flow setting is invalid because of active model errors' },
invalid_namespace_member: { description: 'The namespace member is invalid because of active model errors' },
invalid_attachment: { description: 'The attachment is invalid because of active model errors' },
invalid_flow: { description: 'The flow is invalid because of active model errors' },
project_not_found: { description: 'The namespace project with the given identifier was not found' },
runtime_not_found: { description: 'The runtime with the given identifier was not found' },
runtime_not_assigned: { description: 'The runtime is not assigned to the project' },
runtime_not_compatible: { description: 'The runtime is not compatible with the primary runtime' },
namespace_not_found: { description: 'The namespace with the given identifier was not found' },
flow_not_found: { description: 'The flow with the given identifier was not found' },
namespace_role_not_found: { description: 'The namespace role with the given identifier was not found' },
identity_not_found: { description: 'The external identity with the given identifier was not found' },
user_session_not_found: { description: 'The user session with the given identifier was not found' },
namespace_project_not_found: { description: 'The namespace project with the given identifier was not found' },
namespace_member_not_found: { description: 'The namespace member with the given identifier was not found' },
flow_type_not_found: { description: 'The flow type with the given identifier was not found' },
organization_not_found: { description: 'The organization with the given identifier was not found' },
invalid_function_id: { description: 'The function ID is invalid' },
invalid_parameter_index: { description: 'The parameter index is invalid' },
invalid_reference_value: { description: 'The reference value is invalid' },
referenced_value_not_found: { description: 'A referenced value could not be found' },
invalid_runtime_parameter_definition: { description: 'The runtime parameter definition is invalid' },
invalid_runtime_function_definition: { description: 'The runtime function definition is invalid' },
invalid_runtime_module: { description: 'The runtime module is invalid' },
invalid_module_configuration: { description: 'The module configuration is invalid because of active model errors' },
invalid_module_configuration_definition: { description: 'The module configuration definition is invalid' },
invalid_function_definition: { description: 'The function definition is invalid' },
invalid_parameter_definition: { description: 'The parameter definition is invalid' },
invalid_data_type: { description: 'The data type is invalid because of active model errors' },
data_type_not_found: { description: 'The data type with the given identifier was not found' },
invalid_flow_type: { description: 'The flow type is invalid because of active model errors' },
no_data_type_for_identifier: { description: 'No data type could be found for the given identifier' },
cyclic_data_type_reference: { description: 'A data type dependency cycle was detected' },
invalid_data_type_link: { description: 'The data type link is invalid because of active model errors' },
node_not_found: { description: 'The node with this id does not exist' },
invalid_node_parameter: { description: 'The node parameter is invalid' },
invalid_node_function: { description: 'The node function is invalid' },
invalid_runtime_status: { description: 'The runtime status is invalid because of active model errors' },
invalid_runtime_status_configuration: { description: 'The runtime status configuration is invalid because of active model errors' },
unsupported_authentication: { description: 'The current authentication is not supported for this operation' },
primary_level_not_found: { description: '', deprecation_reason: 'Outdated concept' },
secondary_level_not_found: { description: '', deprecation_reason: 'Outdated concept' },
tertiary_level_exceeds_parameters: { description: '', deprecation_reason: 'Outdated concept' },
missing_primary_runtime: { description: 'The project is missing a primary runtime' },
missing_definition: { description: 'The primary runtime has more definitions than this one' },
outdated_definition: { description: 'The primary runtime has a newer definition than this one' },
}
end
# rubocop:enable Layout/LineLength
end
ErrorCode.prepend_extensions