refactor(app) agent refactoring + a little review

This commit is contained in:
imadev
2026-10-31 20:22:16 +03:00
parent 2ef20e7040
commit 362ba16cc4
25 changed files with 240 additions and 375 deletions
+4
View File
@@ -3,6 +3,7 @@ package store
import (
"context"
"errors"
"log/slog"
"net"
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/common"
@@ -15,6 +16,8 @@ func isUniqueViolation(err error) bool {
return ok && pgErr.Code == "23505"
}
// dbError maps driver failures to contract errors. Unexpected failures are
// logged with their cause so a 500 is never silent.
func dbError(err error) error {
if err == nil {
return nil
@@ -36,5 +39,6 @@ func dbError(err error) error {
return common.Unavailable("database unavailable")
}
slog.Error("unhandled database error", "err", err)
return common.Internal()
}