-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
38 lines (32 loc) · 1.38 KB
/
errors.go
File metadata and controls
38 lines (32 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package es
import "errors"
var (
// ErrAlreadyExists is returned when attempting to create an aggregate that already exists.
ErrAlreadyExists = errors.New("aggregate already exists")
// ErrNotFound is returned when attempting to load an aggregate that doesn't exist.
ErrNotFound = errors.New("aggregate not found")
// ErrConcurrency is returned when a concurrency conflict is detected during save operations.
ErrConcurrency = errors.New("concurrency error")
// ErrInvalidEventSpace is a compatibility-preserved sentinel for invalid event
// compatibility checks, including invalid event-to-aggregate mappings in alternate
// workflows. The default aggregate implementation panics instead of returning it.
ErrInvalidEventSpace = errors.New("invalid event type")
// ErrEventHandlerNotFound is available to alternate aggregate workflows that need
// explicit handler lookup failures.
ErrEventHandlerNotFound = errors.New("event handler not found")
// ErrInvalidEntity is returned when entity validation fails.
ErrInvalidEntity = errors.New("invalid entity")
)
type wrappedSentinelError struct {
message string
sentinel error
}
func (e wrappedSentinelError) Error() string {
return e.message
}
func (e wrappedSentinelError) Unwrap() error {
return e.sentinel
}
func wrapSentinelError(message string, sentinel error) error {
return wrappedSentinelError{message: message, sentinel: sentinel}
}