-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
37 lines (29 loc) · 1.03 KB
/
errors.go
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
package streams
import (
"errors"
"fmt"
)
var (
ErrBusIsShutdown = errors.New("streams: bus has been terminated")
ErrEmptyMessage = errors.New("streams: message is empty")
ErrUnrecoverable = errors.New("streams: unrecoverable error")
ErrEventNotFound = errors.New("streams: event not found")
ErrNoSubscriberRegistered = errors.New("streams: subscriber scheduler has no subscriber tasks")
)
// A ErrUnrecoverableWrap is a special wrapper for certain type of errors with no recoverable action.
type ErrUnrecoverableWrap struct {
ParentErr error
}
var _ error = ErrUnrecoverableWrap{}
var _ fmt.Stringer = ErrUnrecoverableWrap{}
func (u ErrUnrecoverableWrap) String() string {
return u.Error()
}
func (u ErrUnrecoverableWrap) Error() string {
return u.ParentErr.Error()
}
// Unwrap returns ErrUnrecoverable variable. Thus, calls to errors.Is(err, ErrUnrecoverable) routine will detect this
// wrapper as unrecoverable error.
func (u ErrUnrecoverableWrap) Unwrap() error {
return ErrUnrecoverable
}