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

[feature] Add callbacks that trigger on transition failure #366

Conversation

cedric-cordenier
Copy link

Hi there,

We're big fans of statesman at work, but we've found that we'd really appreciate the ability to be able to define callbacks that are triggered when a transition fails. In this PR, I've added a new after_transition_failure hook which extends the existing callback mechanism to add support for callbacks that are triggered if a transition fails.

I'd really appreciate your thoughts on this,

Thanks,

Cedric

Copy link
Contributor

@danwakefield danwakefield left a comment

Choose a reason for hiding this comment

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

Seems like a good idea. My only concern is that it might not be immediately obvious that after_transition_failure would trigger for both GuardFailedError and TransitionFailedError

How would you feel about separating it into after_transition_failure & after_guard_failure ?

@cedric-cordenier
Copy link
Author

Hi @danwakefield -- sounds good. That's more obvious! I'll find some time to amend this PR tomorrow :)

@cedric-cordenier
Copy link
Author

@danwakefield I've updated my PR -- let me know if you have any further comments/questions

Copy link
Contributor

@danwakefield danwakefield left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. I'll update the README to add some details about the new feature before tagging a release.

@danwakefield danwakefield merged commit befa56b into gocardless:master Nov 5, 2019
@cedric-cordenier cedric-cordenier deleted the transition-failure-callbacks branch November 5, 2019 15:56
@danwakefield danwakefield mentioned this pull request Nov 5, 2019
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.

2 participants