skillfed

drf-standardized-errors

Standardize your API error responses.

drf-standardized-errors v0.16.0 510.4K downloads/30d#6,268 on PyPI347
Permissive license Active released

What it is and what it does

DRF Standardized Errors is an exception handler for Django REST Framework that intercepts API errors and reformats them into a consistent JSON structure. Instead of DRF's default varied error responses, it normalizes all 4xx and 5xx errors into a unified format with a type field (validation_error, client_error, or server_error), an errors array containing code, detail, and attr fields, and optional field-level attribution for validation failures.

The package is designed to be plugged into DRF's exception handling pipeline via a single settings change. It handles nested serializers and ListSerializer errors, integrates with error monitoring tools like Sentry, and offers customization hooks to override specific aspects of error handling without rewriting the entire handler. It does not intercept middleware-level errors or unhandled exceptions in debug mode by default.

Use it for:

  • Standardize validation error responses across all endpoints so clients parse a consistent structure.
  • Provide field-level error attribution (attr field) to help frontend forms display errors next to the right inputs.
  • Integrate with Sentry or similar error monitoring to receive errors in a predictable format.
  • Build API documentation that documents a single error response schema instead of multiple formats.
  • Customize error codes and messages globally without modifying individual serializers or views.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts all Django REST Framework API error responses (4xx and 5xx) into a standardized JSON format with consistent error structure, type classification, and field attribution.

Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real pain point in DRF development—inconsistent error response formats. It's particularly valuable if you're building client-facing APIs or integrating with error monitoring. Install it if you want predictable, standardized error responses across your DRF project.

Install

drf-standardized-errors on PyPI

pip

pip install drf-standardized-errors

uv

uv add drf-standardized-errors

poetry

poetry add drf-standardized-errors

Installing drf-standardized-errors

Before you install

Low friction: pure Python wheel with only django and djangorestframework as runtime dependencies. Actively maintained with recent releases; last commit 2026-07-13 and 347 repository stars indicate ongoing support.

License in practice

MIT licensed under permissive terms, allowing commercial and private use with minimal restrictions.

Quickstart

pip install drf-standardized-errors

# In settings.py INSTALLED_APPS:
INSTALLED_APPS = ["drf_standardized_errors"]

# In REST_FRAMEWORK settings:
REST_FRAMEWORK = {
    "EXCEPTION_HANDLER": "drf_standardized_errors.handler.exception_handler"
}

Requires Django >= 3.2 and djangorestframework >= 3.12; only handles errors that reach DRF API views, not middleware-level errors.

Verify before relying

  • Whether the package handles all custom exception types or only DRF built-ins.
  • Performance overhead of exception transformation on high-traffic APIs.
  • Compatibility with async DRF views or ASGI deployments.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 2 — django, djangorestframework
Maintenance actively maintained — 107 days since the last release
Last repo commit
First released
Downloads 510,391/month — #6,268 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: drf_standardized_errors-0.16.0-py3-none-any.whl

Keywords: standardized errors, errors formatter, django rest framework, exception handler

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

drf error standardizationdjango rest framework error handlerapi error response formattingstandardized exception handlerdrf error response wrapperconsistent api error formatdjango rest framework exceptions
drf-pluginerror-handlingapi-standardization

More Application Frameworks packages