Documentation
¶
Overview ¶
Code generated by "gen-template-for-enum"; DO NOT EDIT.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrRecordNotFound ¶
IsErrRecordNotFound checks if the error is a record not found error
Types ¶
type ADetailError ¶
type ADetailError = *aDetailError
func NewWithDetail ¶
func NewWithDetail[DeT YourDetailInside]( ctx context.Context, code YourErrorCode, origin error, detail DeT, templateData ...map[string]any, ) ADetailError
func ValidationErrsAggregate ¶
func ValidationErrsAggregate( ctx context.Context, validationErrs []validation.ValidationErr, ) ADetailError
func (ADetailError) MarshalMsgpack ¶
func (e ADetailError) MarshalMsgpack() ([]byte, error)
func (ADetailError) UnmarshalMsgpack ¶
func (e ADetailError) UnmarshalMsgpack(data []byte) error
type AError ¶
type AError = apperror.AppError[YourErrorCode]
type AMultiError ¶
type AMultiError = *aMultiError
func Append ¶
func Append(mErr AMultiError, appErrs ...ASingleError) AMultiError
func (AMultiError) Errors ¶
func (me AMultiError) Errors() []ASingleError
type ASingleError ¶
type ASingleError = *aError
func New ¶
func New( ctx context.Context, code YourErrorCode, origin error, templateData ...map[string]any, ) ASingleError
func (ASingleError) MarshalMsgpack ¶
func (e ASingleError) MarshalMsgpack() ([]byte, error)
func (ASingleError) UnmarshalMsgpack ¶
func (e ASingleError) UnmarshalMsgpack(data []byte) error
type DetailAllowType ¶
type DetailAllowType interface {
SenderInfo |
ValidationDetail
}
type ErrorCode ¶
type ErrorCode int
const ( ErrInvalidInput ErrorCode // Invalid input. ErrManyValidation // Your request has {{.Length}} validation errors ErrValidateRequired // Param is required. ErrValidateLen // The length of param must be as specified. ErrValidateMin // The length of param must meet the minimum requirement. ErrValidateMax // The length of param must not exceed the maximum allowed. ErrValidateEq // Param must have a specific value. ErrValidateNe // Param must have a value different from the specified value. ErrValidateLt // Param must be less than the specified value. ErrValidateLte // Param must be less than or equal to the specified value. ErrValidateGt // Param must be greater than the specified value. ErrValidateGte // Param must be greater than or equal to the specified value. ErrValidateOneOf // Param must be one of the predefined values. ErrValidateIndividualNumber // Invalid format of individual number. ErrValidateImageBase64 // Invalid format of image base64. ErrValidatePassword // Invalid password. Must be at least 8 characters with letters (A-Z, a-z), numbers (0-9), and special characters. ErrValidateUsername // Invalid username. It must be at least 5 characters long, with the first letter being an alphabet character, and the remaining characters can be letters (A-Z, a-z), numbers (0-9), underscore (_) and dot (.). ErrValidateEmail // Invalid email format. ErrValidatePhone // Invalid phone number format. ErrValidateUUID // Invalid UUID format ErrInvalidVerifyCode // Invalid verify code. ErrProvideInvalidIdentityType // Invalid identity type. Must be email or phone number. ErrProvideNotExistedIdentity // Email or phone number does not exist. ErrProvideNotYetConfirmedIdentity // Email or phone number has not been confirmed. ErrProvideExistedEmail // Email has already been registered. ErrProvideConfirmedEmail // Email has been confirmed. ErrProvideExpiredConfirmCode // Confirm code has been expired. LogicErrOauth2ClientIDNotMatch // Oauth2 authorization code is not found. LogicErrOauth2RedirectHostNotAllow // Oauth2 redirect uri is not allowed. LogicErrOauth2AuthorizationCodeNotFound // Oauth2 authorization code is not found. LogicErrOauth2AuthorizationCodeExpired // Oauth2 authorization code is expired. LogicErrVerifyConfirmCodFail // Verify confirm code fail NewPasswordSameWithOldPassword // New password cannot be the same as the old password ExceedUserInvitationLimit // Exceed user invitation limit for this user, must waiting before resend invitation. SessionHasBeenRevokedBefore // Session has been revoked before. ErrEmailAlreadyConfirmed // Email has been confirmed. ErrPhoneAlreadyConfirmed // Phone has been confirmed. ErrEmailAlreadyExisted // Email has already been registered. ErrPhoneAlreadyExisted // Phone has already been registered. )
const ( SessionExceededMaxAge ErrorCode // Session exceeded max age please login again. LogicErrSessionExpired // Session has been expired. LogicErrUserNeedVerified // This user need verifying. InvitationTokenInvalid // Invitation token token is invalid. ConfirmationTokenInvalid // Confirmation token is invalid. ResetPasswordTokenInvalid // Reset password token is invalid. RefreshTokenInvalid // Refresh token is invalid. LogicErrMissingAuthHeader // Missing Authorization header. LogicErrAccessTokenVerifyFail // Can not verify AccessToken signature or token is expired. LogicErrSessionHasBeenRevoked // Session has been revoked. LogicErrWrongPassword // Wrong password. LogicErrAlreadyExistedPassword // Password already exists. LogicErrEmailOrPasswordIncorrect // Email or password is incorrect ErrAccessTokenFormat // Access token's format wrong. ErrConfirmationTokenFormat // Confirmation token's format wrong. ErrInvitationTokenFormat // Invitation token's format wrong. ErrSignupConfirmTokenInvalid // Signup confirm token is invalid. ErrEmailUserAlreadyExists // User already exists with this email. )
const ( LogicErrRefreshTokenIsExpired ErrorCode // Refresh token is expired. LogicErrSessionHasBeenRevokedOrExpired // Session has been revoked or expired. LogicErrSessionIsNotExisted // Session is not existed. LogicErrInvalidRefreshToken // Invalid refresh token. LogicErrInvalidToken // Invalid token. LogicRefreshTokenMustUseOnlyOnce // Refresh token must be used only once. RateLimitExceeded // Rate limit exceeded. InvalidInputSchema // Invalid input schema )
const ( UserNotFound ErrorCode // User not found. YourAccountNotFound // Your account not found. RecordNotFound // Resource not found. ErrDdbDuplicatedItem // Duplicated id. ErrRecordNotFound // Record not found )
const ( ErrUnmarshal ErrorCode // Unexpected error. ErrMarshal // Unexpected error. ErrUnexpectedInput // Unexpected error. ErrUnexpectedConfig // Unexpected config. Check value in config file or flags' value in cli ErrUnexpectedTemplate // Unexpected error. ErrUnexpectedSES // Unexpected error. ErrUnexpectedRedis // Unexpected error. ErrUnexpectedDatabase // Unexpected error. ErrUnexpectedDynamoDB // Unexpected error. ErrUnexpectedBussiness // Unexpected error. ErrUnexpectedNetwork // Unexpected error. ErrUnexpectedSyscall // Unexpected error. ErrUnexpectedCodeLogic // Unexpected error. ErrUnexpectedShouldUnreachable // Unexpected error. ErrUnexpectedWithMsg // Unexpected error. {{.Msg}} LogicErrDuplicateRecord // Username, email or phone has already been register. LogicErrOauth2ClientSecretNotMatch // Oauth2 client secret is incorrect. LogicErrOauth2PkceCodeVerifierNotMatch // Oauth2 PKCE code verifier is not match. ErrUnexpectedPubsub // Can not send request to pubsub ErrHandlerNotFoundForCommandName // Can not found handler for command name {{.Name}} ErrServerIsShuttingDown // Server is shutting down. )
const ( ErrPermissionDenied ErrorCode // Permission denied. ActionNotAllowed // Action not allowed. )
type MsgpackError ¶
type SenderInfo ¶
type ValidationDetail ¶
type ValidationDetail []ValidationDetailInside
type ValidationDetailInside ¶
type YourDetailInside ¶
type YourDetailInside = DetailAllowType // Or set `type YourDetailInside = any` to not restrict the type
This alias type is used to restrict the type of detail
type YourErrorCode ¶
type YourErrorCode = ErrorCode
This is your own type. Modify it to your own purpose alias type
Click to show internal directories.
Click to hide internal directories.