21
21
22
22
/**
23
23
* Common status code for public API.
24
+ * <p>
25
+ * Always follow <a href="https://github.com/GreptimeTeam/greptimedb/blob/main/src/common/error/src/status_code.rs">GreptimeDB's STATUS CODE</a>
24
26
*/
25
27
public enum Status {
26
28
// ====== Begin of common status code ==============
@@ -37,8 +39,12 @@ public enum Status {
37
39
Internal (1003 , true ),
38
40
// Invalid arguments.
39
41
InvalidArguments (1004 ),
40
- // / The task is cancelled.
42
+ // The task is cancelled.
41
43
Cancelled (1005 ),
44
+ // Illegal state.
45
+ IllegalState (1006 ),
46
+ // Caused by some error originated from external system.
47
+ External (1007 ),
42
48
// ====== End of common status code ================
43
49
44
50
// ====== Begin of SQL related status code =========
@@ -56,18 +62,35 @@ public enum Status {
56
62
// ====== Begin of catalog related status code =====
57
63
// Table already exists.
58
64
TableAlreadyExists (4000 ),
65
+ // Table not found.
59
66
TableNotFound (4001 ),
67
+ // Table column not found.
60
68
TableColumnNotFound (4002 ),
69
+ // Table column already exists.
61
70
TableColumnExists (4003 ),
71
+ // Database not found.
62
72
DatabaseNotFound (4004 ),
73
+ // Region not found.
63
74
RegionNotFound (4005 ),
75
+ // Region already exists.
64
76
RegionAlreadyExists (4006 ),
77
+ // Region is read-only in current state.
65
78
RegionReadonly (4007 ),
79
+ // Region is not in a proper state to handle specific request.
80
+ RegionNotReady (4008 ),
81
+ // Region is temporarily in busy state.
82
+ RegionBusy (4009 ),
83
+ // Table is temporarily unable to handle the request.
84
+ TableUnavailable (4010 ),
85
+ // Database already exists.
86
+ DatabaseAlreadyExists (4011 ),
66
87
// ====== End of catalog related status code =======
67
88
68
89
// ====== Begin of storage related status code =====
69
90
// Storage is temporarily unable to handle the request
70
91
StorageUnavailable (5000 , true ),
92
+ // Request is outdated, e.g., version mismatch.
93
+ RequestOutdated (5001 ),
71
94
// ====== End of storage related status code =======
72
95
73
96
// ====== Begin of server related status code =====
@@ -91,9 +114,8 @@ public enum Status {
91
114
// Illegal request to connect catalog-schema
92
115
AccessDenied (7005 ),
93
116
// User is not authorized to perform the operation
94
- PermissionDenied (7006 ),
95
- // ====== End of auth related status code =====
96
- ;
117
+ PermissionDenied (7006 );
118
+ // ====== End of auth related status code =====
97
119
98
120
private static final Map <Integer , Status > DICT = new HashMap <>();
99
121
0 commit comments