Skip to main content

Verbose Errors

Test

A simple package for DRF errors formatting

Requirements

  • Python 3.6 or newer
  • Django 3.2 or newer
  • Django Rest Framework 3.14 or newer

Formatting

This package provides the exception handler that formats handled DRF exceptions into verbose error response

Generic error

{
  "errors": [
    {
      "field": null,
      "messages": [
        "You do not have enough permissions to perform this action"
      ]
    }
  ]
}

Error related to an object field

{
  "errors": [
    {
      "field": "name",
      "messages": [
        "This field is required", 
        "This field can not be null"
      ]
    }
  ]
}

Installation

You can install this package using pip:

pip install djangorestframework-verbose-errors

Configuration

Configure your project in order to use the exception handler:

REST_FRAMEWORK = {
    'EXCEPTION_HANDLER': 'rest_framework_verbose_errors.views.exception_handler',
}

License

MIT

Release files for djangorestframework-verbose-errors 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangorestframework-verbose-errors 0.0.6
File Size Uploaded
djangorestframework-verbose-errors-0.0.6.tar.gz 2.9 kB Details

Release files / djangorestframework-verbose-errors-0.0.6.tar.gz

Download URL djangorestframework-verbose-errors-0.0.6.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
39e9c7a5a7248203ed6e66b6e3c459fe27a23679c68507fe3d84155cabe3a364
BLAKE2b-256 checksum
How to use checksums
fb814f6b9f427a5ea5d2e32e8af708fdd404771791eb75eb11c3395f29b9fe68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.0.6 This release

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page