Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Add propagate=False property to swallow exceptions after on_error #59

Closed
wants to merge 1 commit into from

Conversation

gabrtv
Copy link

@gabrtv gabrtv commented Sep 24, 2014

When using on_error we've found it useful to swallow exceptions since the FSM module is already handling the state transition. This PR adds an optional propagate property to control this. Behavior defaults to propagate=True matching current behavior.

Note: a test was included but it's unclear how to run the suite, so it might not be passing. Some docs on how to run the tests would be much appreciated.

@kmmbvnr
Copy link
Collaborator

kmmbvnr commented Sep 25, 2014

Tests could be run with tox command.

Please fix it.

@kmmbvnr
Copy link
Collaborator

kmmbvnr commented Sep 25, 2014

Also, README need to be updated with new option

@kmmbvnr
Copy link
Collaborator

kmmbvnr commented Sep 25, 2014

Btw, could we think about the way to restrict set of exceptions?

So, may be we could accept with same option not only Boolean but a list of exception that going to be hidden

not_propagate=[NotFound, DatabaseError] (probably with some better option name)

@kmmbvnr
Copy link
Collaborator

kmmbvnr commented Nov 12, 2014

Shame on you ) Deis could not be considered 1.0 with unfinished work.

So, my proposed solution is to have new enshroud paramenter, default false.

enshroud=[list of intercepted exception] or enshroud=true to intercept them all

kmmbvnr added a commit that referenced this pull request Oct 14, 2015
@kmmbvnr
Copy link
Collaborator

kmmbvnr commented Oct 14, 2015

I'm not sure that such functionality really required. But if it is true, i think it should be implemented in more explicit way like #f56b0ce

Ping here, if someone have a reasons to wish this commit merged to mainline.

@mmoravcik
Copy link

mmoravcik commented Dec 19, 2018

@kmmbvnr @gabrtv hi, so when exception happens, do we still need to catch it the code?

try:
    order.submit()
except SomeException:
    pass

In the above example, Django FSM will change the status to on_error, right? Catching the exception might look pointless, I guess that was the reason for propagate=True

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

Successfully merging this pull request may close these issues.

None yet

3 participants