Skip to content

Fixed and intuitivized exception handling - #1291

Merged
untitaker merged 8 commits into
pallets:masterfrom
flying-sheep:errorhandler-rework
Apr 11, 2015
Merged

untitaker merged 8 commits into
pallets:masterfrom
flying-sheep:errorhandler-rework

Conversation

@flying-sheep

Copy link
Copy Markdown
Contributor

abandoning pull request #1281 for this.

the rationale for this is to

  1. fix some logic flaws
  2. make errorhandlers more intuitive by making them rely on exception hierarchy instead of registration order
  3. Enable 500 handlers on blueprint level

and all this while without breaking compatibility in not-already-broken usecases (which rely on the logic flaws i fixed)

TODO:

  1. bake this into some tests as well

  2. one error says

    It is currently not possible to register a 500 internal server error on a per-blueprint level.

    why is this?

@flying-sheep

This comment has been minimized.

@untitaker untitaker added this to the 1.0 milestone Dec 23, 2014
Comment thread flask/app.py Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@danielchatfield

This comment has been minimized.

@flying-sheep

This comment has been minimized.

Comment thread flask/app.py Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

@flying-sheep
flying-sheep force-pushed the errorhandler-rework branch 3 times, most recently from 16f0286 to 2977b77 Compare December 28, 2014 15:22
Comment thread flask/app.py

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@untitaker

Copy link
Copy Markdown
Contributor

@flying-sheep This looks really good now BTW.

Comment thread flask/app.py Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@flying-sheep

Copy link
Copy Markdown
Contributor Author

@flying-sheep This looks really good now BTW.

thanks! :D

@untitaker

Copy link
Copy Markdown
Contributor

@flying-sheep Don't invest too much time in this yet, @mitsuhiko must decide this ultimatively.

@flying-sheep

Copy link
Copy Markdown
Contributor Author

well, this is already discussed and implemented, everything that comes now is mere minutes of work, so i might as well.

otherwise i trust mitsuhiko’s judgment except in the matter of Python 2 vs Python 3 ;)

@flying-sheep

Copy link
Copy Markdown
Contributor Author

and regarding judgment: do you think the cleanness and neatness of grouping exception handlers using their http codes (or lack thereof) is worth the fact that it’s unnecessary for the logic? or not?

@untitaker

Copy link
Copy Markdown
Contributor

I don't think it's worth it, but @mitsuhiko may come up with a reason why it is absolutely necessary (I've encountered such surprises before).

@flying-sheep

Copy link
Copy Markdown
Contributor Author

can we now start the magic dance that summons him?

@untitaker

Copy link
Copy Markdown
Contributor

I still don't know how that dance works. But I usually spam him on IRC regularly.

@untitaker

Copy link
Copy Markdown
Contributor

@flying-sheep Would it be possible to fix #503 in the run?

Comment thread flask/app.py Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

@untitaker

Copy link
Copy Markdown
Contributor

Requesting help on reviewing this PR. I think it's a great change that definetly should land in 1.0.

@flying-sheep

Copy link
Copy Markdown
Contributor Author

btw. the regression test fails on master currently so i din’t break anything, i just rebased :)

@untitaker

Copy link
Copy Markdown
Contributor

btw. the regression test fails on master currently so i din’t break anything, i just rebased :)

It doesn't fail for me (I reverted the offending commit a while ago)

@flying-sheep

Copy link
Copy Markdown
Contributor Author

oh, strange. it doesn’t fail on travis. wat.

locally, test_memory_consumption fails.

so what did mitsuhiko say on IRC? you asking for reviews implies that he likes this?

@untitaker

Copy link
Copy Markdown
Contributor

Hmm, how does #1407 behave for you then?

@flying-sheep

Copy link
Copy Markdown
Contributor Author

so checkout unitaker/flask#no-threads and try? will do

/e: still test_regression.assert_no_leak fails

Comment thread flask/app.py

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@untitaker

Copy link
Copy Markdown
Contributor

OK, so behavior-wise the current PR is excellent as-is.

The only thing missing now are docs. From a quick glance at errorhandling.rst there doesn't seem to be anything contradictory in there, but we should definetly clarify the current behavior.

We also need something in upgrading.rst, and a changelog entry.

@flying-sheep

Copy link
Copy Markdown
Contributor Author

writing something up right now, but errorhandling.rst doesn’t seem to contain anything about error handlers, only logging and debugging AFAICS

@untitaker

Copy link
Copy Markdown
Contributor

We need to document how Flask prioritizes errorhandlers, doesn't matter where. errorhandling seemed like the most related page to me.

untitaker added a commit that referenced this pull request Apr 11, 2015
Fixed and intuitivized exception handling
@untitaker
untitaker merged commit aed464b into pallets:master Apr 11, 2015
@flying-sheep
flying-sheep deleted the errorhandler-rework branch April 11, 2015 16:14
@untitaker

Copy link
Copy Markdown
Contributor

Thanks @flying-sheep!

@untitaker untitaker mentioned this pull request Apr 11, 2015
6 tasks done
@flying-sheep

Copy link
Copy Markdown
Contributor Author

been a pleasure 😄

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants