fix: classify database outages and restore real HTTP fault checks

This commit is contained in:
Vladislav Agapov
2026-10-16 10:19:46 +03:00
parent b90581f613
commit 87e1e5d94b
25 changed files with 449 additions and 16 deletions
@@ -25,6 +25,8 @@ func publicFailure(code, message string) error {
// Unknown errors receive a fixed response without exposing their details.
func publicError(err error) error {
switch {
case errors.Is(err, service.ErrUnavailable):
return publicFailure(codeUnavailable, "dependency unavailable")
case errors.Is(err, service.ErrInvalid):
return fielderr.WithStatus(err, fielderr.NewStatusCode(codeInvalid), "invalid request")
case errors.Is(err, service.ErrUnauthorized):