refactor: standardize error handling with exception.Builder
- Replace hardcoded error messages with structured error codes using exception.Builder. - Introduce new common error constants in exception/common.go (CommonErrorInvalidInput, CommonErrorUserNotFound, etc.). - Update exception/specific.go with domain-specific errors and remove redundant ones. - Apply consistent error handling across auth, event, user services and middleware. Co-authored-by: Gemini <gemini@google.com> Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
@@ -2,4 +2,59 @@ package exception
|
||||
|
||||
const (
|
||||
ApiVersionNotFound = "00001"
|
||||
|
||||
// Auth Service
|
||||
// Endpoint: AuthRedirectEndpoint (01)
|
||||
AuthRedirectTokenInvalid = "00001"
|
||||
AuthRedirectClientNotFound = "00002"
|
||||
AuthRedirectUriMismatch = "00003"
|
||||
AuthRedirectInvalidUri = "00004"
|
||||
|
||||
// Endpoint: AuthMagicEndpoint (02)
|
||||
AuthMagicTurnstileFailed = "00001"
|
||||
AuthMagicCodeGenFailed = "00002"
|
||||
AuthMagicInvalidExternalUrl = "00003"
|
||||
AuthMagicInvalidEmailConfig = "00004"
|
||||
|
||||
// Endpoint: AuthTokenEndpoint (03)
|
||||
AuthTokenInvalidToken = "00001"
|
||||
AuthTokenGenFailed = "00002"
|
||||
|
||||
// Endpoint: AuthRefreshEndpoint (04)
|
||||
AuthRefreshInvalidToken = "00001"
|
||||
AuthRefreshRenewFailed = "00002"
|
||||
|
||||
// Endpoint: AuthExchangeEndpoint (05)
|
||||
AuthExchangeGetUserIdFailed = "00001"
|
||||
AuthExchangeCodeGenFailed = "00002"
|
||||
AuthExchangeInvalidRedirectUri = "00003"
|
||||
|
||||
// Event Service
|
||||
// Endpoint: EventInfoEndpoint (01)
|
||||
EventInfoNotFound = "00001"
|
||||
|
||||
// Endpoint: EventCheckinEndpoint (02)
|
||||
EventCheckinGenCodeFailed = "00001"
|
||||
|
||||
// Endpoint: EventCheckinQueryEndpoint (03)
|
||||
EventCheckinQueryRecordNotFound = "00001"
|
||||
|
||||
// Endpoint: EventCheckinSubmitEndpoint (04)
|
||||
// (None)
|
||||
|
||||
// User Service
|
||||
// Endpoint: UserInfoEndpoint (01)
|
||||
// (None)
|
||||
|
||||
// Endpoint: UserUpdateEndpoint (02)
|
||||
// (None)
|
||||
|
||||
// Endpoint: UserListEndpoint (03)
|
||||
UserListMeilisearchFailed = "00001"
|
||||
|
||||
// Endpoint: UserFullEndpoint (04)
|
||||
// (None)
|
||||
|
||||
// Endpoint: UserCreateEndpoint (05)
|
||||
// (None)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user