feat(ports): define consumer-side interfaces, sentinel errors, IsUniqueViolation
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package ports
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"booklib/internal/store"
|
||||
)
|
||||
|
||||
// Re-export sentinel errors so handlers can use errors.Is via ports.
|
||||
var (
|
||||
ErrLastAdmin = store.ErrLastAdmin
|
||||
ErrUniqueViolation = store.ErrUniqueViolation
|
||||
)
|
||||
|
||||
// IsUniqueViolation consolidates the pg 23505 check into a single predicate.
|
||||
func IsUniqueViolation(err error) bool { return store.IsUniqueViolation(err) }
|
||||
|
||||
// Upload sentinel errors.
|
||||
var (
|
||||
ErrTooLarge = errors.New("file too large")
|
||||
ErrIncomplete = errors.New("upload incomplete")
|
||||
ErrSizeMismatch = errors.New("size mismatch")
|
||||
ErrNotFound = errors.New("not found")
|
||||
)
|
||||
Reference in New Issue
Block a user