fix(storage): map context deadline exceeded to unavailable error

This commit is contained in:
Голиков Maximillian Антон
2026-10-02 15:38:47 +03:00
parent e0723c0e98
commit b40ac615b3
2 changed files with 12 additions and 4 deletions
+5 -2
View File
@@ -27,8 +27,11 @@ func mapError(err error) error {
if errors.Is(err, pgx.ErrNoRows) {
return err
}
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
return err
if errors.Is(err, context.DeadlineExceeded) {
return &domain.UnavailableError{Reason: "превышено время ожидания БД"}
}
if errors.Is(err, context.Canceled) {
return &domain.UnavailableError{Reason: "запрос отменён"}
}
return &domain.UnavailableError{Reason: err.Error()}
}