forked from mtusi2026/mtusi2026lab6
feat: add bounded observability and verified SLO incident alerts
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package production
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab6/internal/service"
|
||||
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab6/internal/store"
|
||||
)
|
||||
|
||||
// normalizeStoreError maps expected storage failures to application errors.
|
||||
// Unexpected failures retain their cause for the transport's safe fallback.
|
||||
func normalizeStoreError(err error) error {
|
||||
switch {
|
||||
case errors.Is(err, store.ErrNotFound):
|
||||
return service.ErrNotFound
|
||||
case errors.Is(err, store.ErrConflict):
|
||||
return service.ErrConflict
|
||||
case errors.Is(err, store.ErrCapacity):
|
||||
return service.ErrCapacity
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user