21 lines
561 B
Go
21 lines
561 B
Go
package usecase
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gateway/internal/model/notification"
|
|
)
|
|
|
|
func wrapRepoErr(err error) error {
|
|
if errors.Is(err, notification.ErrNotFound) {
|
|
return errb.ResNotFound("notification", "").WithCause(err)
|
|
}
|
|
if errors.Is(err, notification.ErrInvalidObjectID) {
|
|
return errb.ResInvalidMeasureID("notification id").WithCause(err)
|
|
}
|
|
if errors.Is(err, notification.ErrDuplicateIdempotency) {
|
|
return errb.ResAlreadyExist("notification idempotency key").WithCause(err)
|
|
}
|
|
return errb.DBError("notification repository error").WithCause(err)
|
|
}
|