44 lines
2.5 KiB
Go
44 lines
2.5 KiB
Go
|
|
// Package errcode provides internal error definition and business error definition
|
||
|
|
package errcode
|
||
|
|
|
||
|
|
var (
|
||
|
|
// ErrProcessSuccess define variable to indicates request process success
|
||
|
|
ErrProcessSuccess = newError(20000, "request process success")
|
||
|
|
|
||
|
|
// ErrInvalidToken define variable to provided token does not conform to the expected format (e.g., missing segments)
|
||
|
|
ErrInvalidToken = newError(40001, "invalid token format")
|
||
|
|
|
||
|
|
// ErrCrossToken define variable to occurs when an update attempt involves multiple components, which is restricted by business logic
|
||
|
|
ErrCrossToken = newError(40002, "cross-component update not allowed")
|
||
|
|
|
||
|
|
// ErrRetrieveFailed define variable to indicates a failure in fetching the project-to-table name mapping from the configuration.
|
||
|
|
ErrRetrieveFailed = newError(40003, "retrieve table mapping failed")
|
||
|
|
|
||
|
|
// ErrFoundTargetFailed define variable to returned when the specific database table cannot be identified using the provided token info.
|
||
|
|
ErrFoundTargetFailed = newError(40004, "found target table by token failed")
|
||
|
|
|
||
|
|
// ErrDBQueryFailed define variable to represents a generic failure during a PostgreSQL SELECT or SCAN operation.
|
||
|
|
ErrDBQueryFailed = newError(50001, "query postgres database data failed")
|
||
|
|
|
||
|
|
// ErrDBUpdateFailed define variable to represents a failure during a PostgreSQL UPDATE or SAVE operation.
|
||
|
|
ErrDBUpdateFailed = newError(50002, "update postgres database data failed")
|
||
|
|
|
||
|
|
// ErrDBzeroAffectedRows define variable to occurs when a database operation executes successfully but modifies no records.
|
||
|
|
ErrDBzeroAffectedRows = newError(50003, "zero affected rows")
|
||
|
|
|
||
|
|
// ErrBeginTxFailed indicates that the system failed to start a new PostgreSQL transaction.
|
||
|
|
ErrBeginTxFailed = newError(50004, "begin postgres transaction failed")
|
||
|
|
|
||
|
|
// ErrCommitTxFailed indicates that the PostgreSQL transaction could not be committed successfully.
|
||
|
|
ErrCommitTxFailed = newError(50005, "postgres database transaction commit failed")
|
||
|
|
|
||
|
|
// ErrCachedQueryFailed define variable to indicates an error occurred while attempting to fetch data from the Redis cache.
|
||
|
|
ErrCachedQueryFailed = newError(60001, "query redis cached data failed")
|
||
|
|
|
||
|
|
// ErrCacheSyncWarn define variable to partial success state: the database was updated, but the subsequent Redis cache refresh failed.
|
||
|
|
ErrCacheSyncWarn = newError(60002, "postgres database updated, but cache sync failed")
|
||
|
|
|
||
|
|
// ErrCacheQueryFailed define variable to indicates query cached data by token failed.
|
||
|
|
ErrCacheQueryFailed = newError(60003, "query cached data by token failed")
|
||
|
|
)
|