add network err

This commit is contained in:
i.smyshlyaev 2025-10-16 13:23:45 +03:00
parent da80211647
commit 7a4f0c1ab9
1 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,7 @@ const (
ErrorTypeInternal ErrorType = "INTERNAL" ErrorTypeInternal ErrorType = "INTERNAL"
ErrorTypeUnauthorized ErrorType = "UNAUTHORIZED" ErrorTypeUnauthorized ErrorType = "UNAUTHORIZED"
ErrorTypeForbidden ErrorType = "FORBIDDEN" ErrorTypeForbidden ErrorType = "FORBIDDEN"
ErrorTypeNetwork ErrorType = "NETWORK"
) )
// AppError - кастомная ошибка приложения // AppError - кастомная ошибка приложения
@ -67,6 +68,14 @@ func NewNotFoundError(message string) *AppError {
} }
} }
func NewNetworkError(message string) *AppError {
return &AppError{
Type: ErrorTypeNetwork,
Message: message,
Code: 0, // Network errors don't have HTTP codes
}
}
func NewInternalError(message string) *AppError { func NewInternalError(message string) *AppError {
return &AppError{ return &AppError{
Type: ErrorTypeInternal, Type: ErrorTypeInternal,