Django Web Exceptions
Throwing web exceptions like in AioHTTP
What and why?
In AioHTTP you can raise any response as exception (this is very cool). But Django can raise only 3+1 web exceptions.
- 400 SuspiciousOperation
- 403 PermissionDenied
- 404 Http404
- 500 Any other non catched exception
This package allow you to raise as exception any of HTTP response.
Documentation
The full documentation is at https://web-exceptions.readthedocs.io.
Quickstart
Install Django Web Exceptions:
pip install django-web-exceptions
Add it to your MIDDLEWARE:
Features
Import exceptions and raise anywhere
Also you can customize any kind of exception status code as custom handler, defined in urls.py like django error handlers .
For more example see example proj
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Credits
Tools used in rendering this package: