events/errors.go
Leon Mika 91d1562e0e Added TryFire
This allows handlers to return errors which will be returned to the caller.
Also replaced error returned from On with a panic.
2024-03-09 00:40:42 +00:00

17 lines
279 B
Go

package events
import "fmt"
type HandlerError struct {
topic string
errs []error
}
func (h HandlerError) Error() string {
return fmt.Sprintf("caught %d errors from topic '%v': %v", len(h.errs), h.topic, h.errs)
}
func (h HandlerError) Unwrap() []error {
return h.errs
}