Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events ability to halt #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

larrycinnabar
Copy link

Problem:

We can't halt event loop from an event inside (stop other hooks to be executed)

Fixes #337

Idea of solution is to return a custom ErrHalt that will be considered to stop immediately the loop

Copy link

@fgm fgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can avoid a dependency.

@@ -1,6 +1,8 @@
package authboss

import (
"fmt"
"github.com/friendsofgo/errors"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use "errors" ? It has been including errors.Is since Go 1.13.

@@ -9,6 +11,8 @@ import (
// Event type is for describing events
type Event int

var ErrHalt = fmt.Errorf("event halt")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No param so probably just use errors.New ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to stop EventLoop from inside an event
2 participants