A simple package for DRF errors formatting
- Python 3.6 or newer
- Django 3.2 or newer
- Django Rest Framework 3.14 or newer
This package provides the exception handler that formats handled DRF exceptions into verbose error response
{
"errors": [
{
"field": null,
"messages": [
"You do not have enough permissions to perform this action"
]
}
]
}
{
"errors": [
{
"field": "name",
"messages": [
"This field is required",
"This field can not be null"
]
}
]
}
You can install this package using pip:
pip install djangorestframework-verbose-errors
Configure your project in order to use the exception handler:
REST_FRAMEWORK = {
'EXCEPTION_HANDLER': 'rest_framework_verbose_errors.views.exception_handler',
}