fallbackFunc support distinguish the error param type
yangxikun opened this issue · comments
Hello, In fallbackFunc func(context.Context, error) error
, I want to know whether the error param is a circuit error or other.
The circuitError
in circuit/v3/errors.go
is not exported identifiers.
Hi,
This is purposeful. Dave Cheney has a great blog post Don’t just check errors, handle them gracefully. He mentions Assert errors for behaviour, not type
on that post.
Errors that happen because the circuit is open will have the method CircuitOpen
defined https://github.com/cep21/circuit/blob/v3.0.1/v3/errors.go#L23
Errors that happen because the concurrency limit is reached will have the method ConcurrencyLimitReached
defined at https://github.com/cep21/circuit/blob/v3.0.1/v3/errors.go#L19.
Please check out #78 and let me know if it clarifies the question.
Yes, circuit.Error
interface is great. 😃