yes a lot of stuff

This commit is contained in:
adman
2026-01-18 17:10:46 +01:00
parent ac2713433e
commit 6deff7f6ea
12 changed files with 193 additions and 60 deletions
+14 -4
View File
@@ -27,8 +27,18 @@ type (
Tick struct{}
)
// ErrHandlerDone will stop the event loop.
var ErrHandlerDone = errors.New("handler done")
// HandlerDoneErr will stop the event loop and return the error if provided.
type HandlerDoneErr struct {
Return error
}
func (e HandlerDoneErr) Error() string {
return "HandlerDoneErr"
}
func (e HandlerDoneErr) Unwrap() error {
return e.Return
}
// ErrDontForward will stop the event from being forwarded to other handlers, including anything handlers.
var ErrDontForward = errors.New("dont forward")
@@ -101,8 +111,8 @@ func (l *Loop) Start() (err error) {
break
}
}
if errors.Is(err, ErrHandlerDone) {
err = nil
if errors.Is(err, HandlerDoneErr{}) {
err = errors.Unwrap(err)
}
return
}