add network err
This commit is contained in:
parent
da80211647
commit
7a4f0c1ab9
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue