mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-04 01:07:48 +08:00
Update go server (#13589)
### What problem does this PR solve? 1. Add more CLI command 2. Add some license hooks ### Type of change - [x] New Feature (non-breaking change which adds functionality) - [x] Refactoring Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@ -19,22 +19,64 @@ package common
|
||||
type ErrorCode int
|
||||
|
||||
const (
|
||||
CodeSuccess ErrorCode = 0
|
||||
CodeNotEffective ErrorCode = 10
|
||||
CodeExceptionError ErrorCode = 100
|
||||
CodeArgumentError ErrorCode = 101
|
||||
CodeDataError ErrorCode = 102
|
||||
CodeOperatingError ErrorCode = 103
|
||||
CodeTimeoutError ErrorCode = 104
|
||||
CodeConnectionError ErrorCode = 105
|
||||
CodeRunning ErrorCode = 106
|
||||
CodeResourceExhausted ErrorCode = 107
|
||||
CodePermissionError ErrorCode = 108
|
||||
CodeAuthenticationError ErrorCode = 109
|
||||
CodeBadRequest ErrorCode = 400
|
||||
CodeUnauthorized ErrorCode = 401
|
||||
CodeForbidden ErrorCode = 403
|
||||
CodeNotFound ErrorCode = 404
|
||||
CodeConflict ErrorCode = 409
|
||||
CodeServerError ErrorCode = 500
|
||||
CodeSuccess ErrorCode = 0
|
||||
CodeNotEffective ErrorCode = 10
|
||||
CodeExceptionError ErrorCode = 100
|
||||
CodeArgumentError ErrorCode = 101
|
||||
CodeDataError ErrorCode = 102
|
||||
CodeOperatingError ErrorCode = 103
|
||||
CodeTimeoutError ErrorCode = 104
|
||||
CodeConnectionError ErrorCode = 105
|
||||
CodeRunning ErrorCode = 106
|
||||
CodeResourceExhausted ErrorCode = 107
|
||||
CodePermissionError ErrorCode = 108
|
||||
CodeAuthenticationError ErrorCode = 109
|
||||
CodeLicenseValid ErrorCode = 320
|
||||
CodeLicenseInactiveError ErrorCode = 321
|
||||
CodeLicenseExpiredError ErrorCode = 322
|
||||
CodeLicenseDigestError ErrorCode = 323
|
||||
CodeLicenseTimeRollback ErrorCode = 324
|
||||
CodeLicenseNotFound ErrorCode = 325
|
||||
CodeLicenseUnexpectedError ErrorCode = 326
|
||||
CodeBadRequest ErrorCode = 400
|
||||
CodeUnauthorized ErrorCode = 401
|
||||
CodeForbidden ErrorCode = 403
|
||||
CodeNotFound ErrorCode = 404
|
||||
CodeConflict ErrorCode = 409
|
||||
CodeServerError ErrorCode = 500
|
||||
)
|
||||
|
||||
var errorMessages = map[ErrorCode]string{
|
||||
CodeSuccess: "Success",
|
||||
CodeNotEffective: "Not effective",
|
||||
CodeExceptionError: "System exception",
|
||||
CodeArgumentError: "Invalid argument",
|
||||
CodeDataError: "Data error",
|
||||
CodeOperatingError: "Operation error",
|
||||
CodeTimeoutError: "Timeout",
|
||||
CodeConnectionError: "Connection error",
|
||||
CodeRunning: "System running",
|
||||
CodeResourceExhausted: "Resource exhausted",
|
||||
CodePermissionError: "Permission denied",
|
||||
CodeAuthenticationError: "Authentication failed",
|
||||
CodeLicenseValid: "License valid",
|
||||
CodeLicenseInactiveError: "License inactive",
|
||||
CodeLicenseExpiredError: "License expired",
|
||||
CodeLicenseDigestError: "License digest error",
|
||||
CodeLicenseTimeRollback: "License time rollback detected",
|
||||
CodeLicenseNotFound: "License not found",
|
||||
CodeLicenseUnexpectedError: "Unexpected license error",
|
||||
CodeBadRequest: "Bad request",
|
||||
CodeUnauthorized: "Unauthorized",
|
||||
CodeForbidden: "Forbidden",
|
||||
CodeNotFound: "Resource not found",
|
||||
CodeConflict: "Resource conflict",
|
||||
CodeServerError: "Internal server error",
|
||||
}
|
||||
|
||||
func (e ErrorCode) Message() string {
|
||||
if msg, ok := errorMessages[e]; ok {
|
||||
return msg
|
||||
}
|
||||
return "Unknown error"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user