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

Enchance exception middleware and support richer exception hierarchy #8

Open
cezio opened this issue Jul 4, 2013 · 1 comment
Open

Comments

@cezio
Copy link
Contributor

cezio commented Jul 4, 2013

Redirect middleware is a very good idea, but it's usage is quite narrow. It would be good to use more generic approach, with richer exception hierarchy, which would allow to handle other response types.

Sample use case:

  • you use CBV
  • you check a condition in .get_context(), which is important to any furtner processing in the view,
  • condition is not met and all processing should be halted, client should receive some 4xx response
  • without such infrastructure, get_context should return dictionary, which should be processed by view, which should check the dict and return error response.
  • with such infrastructure you can raise proper exception and handle it the middleware whithout boilerplate code in the view.
@skorokithakis
Copy link
Owner

Hmm, can you post some sample code to illustrate this use case? I'm not clear on what use case it would serve. Thanks!

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

No branches or pull requests

2 participants