Skip to content

Comments

Reraise exceptions within #request instead of continuing#35

Open
mistydemeo wants to merge 2 commits intotechnoweenie:masterfrom
mistydemeo:dont_fall_through_after_rescue
Open

Reraise exceptions within #request instead of continuing#35
mistydemeo wants to merge 2 commits intotechnoweenie:masterfrom
mistydemeo:dont_fall_through_after_rescue

Conversation

@mistydemeo
Copy link

@mistydemeo mistydemeo commented Mar 14, 2017

Previously, if an exception was raised in #request, the function would be allowed to continue through to returning the callback. This callback would almost certainly fail. Raising here, rather than returning after calling the callback with the exception, makes more sense to me because the return value is still expected to be a function.

I ran into this when an exception was raised on the line where req is assigned; it went on to return the function anyway, which then failed because req was never defined.

cc @technicalpickles

Previously, if an exception was raised in #request, the function would
be allowed to continue through to returning the callback. This callback
would almost certainly fail.
@technicalpickles
Copy link
Collaborator

I'm just trying to think if there'd be any problems with having a callback getting the error, and also the error being thrown.

Considering it's part of the setup, it probably makes more sense to just throw it, but I'm not sure how that'd impact consumers.

@mistydemeo
Copy link
Author

Updated to just throw - at that point, we don't need to catch the exception anymore. (Diff best viewed with ?w=1.) I don't know enough about the impact this might have on other users, but I did get bit by this again today, so it'd be useful to get this in!

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