Passed
Pull Request — develop (#47)
by inkhey
01:48
created

backend.tracim_backend.error   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 32
dl 0
loc 54
rs 10
c 0
b 0
f 0
1
# Error code format
2
# 1xxx: not found error
3
# 2xxx: validation error
4
# 3xxx: conflict error
5
# 4xxx: authentication and authorization
6
# 9xxx: core errors(family of error code reserved
7
# for unclassable errors or very low level errors)
8
9
10
# Tracim Not found Error
11
ERROR_CODE_USER_NOT_FOUND = '1001'
12
ERROR_CODE_WORKSPACE_NOT_FOUND = '1002'
13
ERROR_CODE_CONTENT_NOT_FOUND = '1003'
14
ERROR_CODE_PARENT_NOT_FOUND = '1004'
15
# Preview Based
16
ERROR_CODE_UNAVAILABLE_PREVIEW_TYPE = '1011'
17
ERROR_CODE_PAGE_OF_PREVIEW_NOT_FOUND = '1012'
18
ERROR_CODE_UNAIVALABLE_PREVIEW = '1013'
19
20
# Validation Error
21
ERROR_CODE_GENERIC_SCHEMA_VALIDATION_ERROR = '2001'
22
# Not in Tracim Request #
23
ERROR_CODE_USER_NOT_IN_TRACIM_REQUEST = '2011'
24
ERROR_CODE_WORKSPACE_NOT_IN_TRACIM_REQUEST = '2012'
25
ERROR_CODE_CONTENT_NOT_IN_TRACIM_REQUEST = '2013'
26
# Invalid ID #
27
ERROR_CODE_USER_INVALID_USER_ID = '2021'
28
ERROR_CODE_WORKSPACE_INVALID_ID = '2022'
29
ERROR_CODE_CONTENT_INVALID_ID = '2023'
30
ERROR_CODE_COMMENT_INVALID_ID = '2024'
31
32
# Other #
33
ERROR_CODE_CONTENT_TYPE_NOT_ALLOWED = '2031'
34
ERROR_CODE_WORKSPACE_DO_NOT_MATCH = '2032'
35
ERROR_CODE_PREVIEW_DIM_NOT_ALLOWED = '2033'
36
ERROR_CODE_WRONG_USER_PASSWORD = '2034'
37
ERROR_CODE_PASSWORD_DO_NOT_MATCH = '2035'
38
ERROR_CODE_EMAIL_ALREADY_EXIST_IN_DB = '2036'
39
ERROR_CODE_EMAIL_VALIDATION_FAILED = '2037'
40
ERROR_CODE_EMAIL_UNALLOWED_SUBCONTENT = '2038'
41
ERROR_CODE_INVALID_RESET_PASSWORD_TOKEN = '2039'
42
ERROR_CODE_EXPIRED_RESET_PASSWORD_TOKEN = '2040'
43
ERROR_CODE_SAME_VALUE_ERROR = '2041'
44
45
# Conflict Error
46
ERROR_CODE_USER_ALREADY_EXIST = '3001'
47
ERROR_CODE_CONTENT_LABEL_ALREADY_USED_THERE = '3002'
48
49
# Auth Error
50
ERROR_CODE_AUTHENTICATION_FAILED = '4001'
51
# Right Error
52
ERROR_CODE_INSUFFICIENT_USER_PROFILE = '4002'
53
ERROR_CODE_INSUFFICIENT_USER_ROLE_IN_WORKSPACE = '4003'
54