22 lines
815 B
Go
22 lines
815 B
Go
package check
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/nats-io/nats.go"
|
|
)
|
|
|
|
// Unheard is the error of a call that reached nobody: the bus had no responder for it, or none answered within the call's
|
|
// bound. The program wraps the errors of its forge calls in it where the bus gives a timeout; a no-responders error is
|
|
// known as it is. A build step is no call since R4g: an ask whose node stops is delivered again by its stream (ADR 0525 §6).
|
|
type Unheard struct{ Err error }
|
|
|
|
func (u *Unheard) Error() string { return u.Err.Error() }
|
|
func (u *Unheard) Unwrap() error { return u.Err }
|
|
|
|
// isUnheard says whether err is a call that reached nobody. A step that began and failed, or ended failed, is not.
|
|
func isUnheard(err error) bool {
|
|
var u *Unheard
|
|
return errors.As(err, &u) || errors.Is(err, nats.ErrNoResponders)
|
|
}
|