-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror.go
More file actions
23 lines (20 loc) · 865 Bytes
/
error.go
File metadata and controls
23 lines (20 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package hoglet
// Error is the error type used for circuit breaker errors. It can be used to separate circuit errors from errors
// returned by the wrapped function.
type Error struct {
msg string
}
// Error implements the error interface.
func (b Error) Error() string {
return "hoglet: " + b.msg
}
var (
// ErrCircuitOpen is returned when a circuit is open and not allowing calls through.
ErrCircuitOpen = Error{msg: "breaker is open"}
// ErrConcurrencyLimitReached is returned by a [Circuit] using [WithConcurrencyLimit] in non-blocking mode when the
// set limit is reached.
ErrConcurrencyLimitReached = Error{msg: "concurrency limit reached"}
// ErrWaitingForSlot is returned by a [Circuit] using [WithConcurrencyLimit] in blocking mode when a context error
// occurs while waiting for a slot.
ErrWaitingForSlot = Error{msg: "waiting for slot"}
)