{"id":13625140,"url":"https://github.com/ghazi-git/drf-standardized-errors","last_synced_at":"2026-04-29T11:01:16.955Z","repository":{"id":37464228,"uuid":"489673794","full_name":"ghazi-git/drf-standardized-errors","owner":"ghazi-git","description":"Standardize your DRF API error responses","archived":false,"fork":false,"pushed_at":"2025-12-04T13:30:19.000Z","size":298,"stargazers_count":323,"open_issues_count":5,"forks_count":19,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-06T09:19:03.712Z","etag":null,"topics":["api","django","django-rest-framework","error-formatter","error-response","exception-handling","python","standardized-errors"],"latest_commit_sha":null,"homepage":"https://drf-standardized-errors.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghazi-git.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-07T12:57:34.000Z","updated_at":"2025-12-05T13:55:23.000Z","dependencies_parsed_at":"2024-02-28T20:31:18.257Z","dependency_job_id":"f0e158df-b39e-49bc-9b71-94eeabe31b23","html_url":"https://github.com/ghazi-git/drf-standardized-errors","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/ghazi-git/drf-standardized-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghazi-git%2Fdrf-standardized-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghazi-git%2Fdrf-standardized-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghazi-git%2Fdrf-standardized-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghazi-git%2Fdrf-standardized-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghazi-git","download_url":"https://codeload.github.com/ghazi-git/drf-standardized-errors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghazi-git%2Fdrf-standardized-errors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31407828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","django","django-rest-framework","error-formatter","error-response","exception-handling","python","standardized-errors"],"created_at":"2024-08-01T21:01:51.284Z","updated_at":"2026-04-04T18:14:02.693Z","avatar_url":"https://github.com/ghazi-git.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# DRF Standardized Errors\n\nStandardize your [DRF](https://www.django-rest-framework.org/) API error responses.\n\n[![Read the Docs](https://img.shields.io/readthedocs/drf-standardized-errors)](https://drf-standardized-errors.readthedocs.io/en/latest/)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ghazi-git/drf-standardized-errors/tests.yml?branch=main\u0026label=Tests\u0026logo=GitHub)](https://github.com/ghazi-git/drf-standardized-errors/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/ghazi-git/drf-standardized-errors/branch/main/graph/badge.svg?token=JXTTT1KVBR)](https://codecov.io/gh/ghazi-git/drf-standardized-errors)\n[![PyPI](https://img.shields.io/pypi/v/drf-standardized-errors)](https://pypi.org/project/drf-standardized-errors/)\n[![PyPI - License](https://img.shields.io/pypi/l/drf-standardized-errors)](https://github.com/ghazi-git/drf-standardized-errors/blob/main/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nBy default, the package will convert all API error responses (4xx and 5xx) to the following standardized format:\n```json\n{\n  \"type\": \"validation_error\",\n  \"errors\": [\n    {\n      \"code\": \"required\",\n      \"detail\": \"This field is required.\",\n      \"attr\": \"name\"\n    },\n    {\n      \"code\": \"max_length\",\n      \"detail\": \"Ensure this value has at most 100 characters.\",\n      \"attr\": \"title\"\n    }\n  ]\n}\n```\n```json\n{\n  \"type\": \"client_error\",\n  \"errors\": [\n    {\n      \"code\": \"authentication_failed\",\n      \"detail\": \"Incorrect authentication credentials.\",\n      \"attr\": null\n    }\n  ]\n}\n```\n```json\n{\n  \"type\": \"server_error\",\n  \"errors\": [\n    {\n      \"code\": \"error\",\n      \"detail\": \"A server error occurred.\",\n      \"attr\": null\n    }\n  ]\n}\n```\n\n\n## Features\n\n- Highly customizable: gives you flexibility to define your own standardized error responses and override\nspecific aspects the exception handling process without having to rewrite everything.\n- Supports nested serializers and ListSerializer errors\n- Plays nicely with error monitoring tools (like Sentry, ...)\n\n\n## Requirements\n\n- python \u003e= 3.8\n- Django \u003e= 3.2\n- DRF \u003e= 3.12\n\n\n## Quickstart\n\nInstall with `pip`\n```shell\npip install drf-standardized-errors\n```\n\nAdd drf-standardized-errors to your installed apps\n```python\nINSTALLED_APPS = [\n    # other apps\n    \"drf_standardized_errors\",\n]\n```\n\nRegister the exception handler\n```python\nREST_FRAMEWORK = {\n    # other settings\n    \"EXCEPTION_HANDLER\": \"drf_standardized_errors.handler.exception_handler\"\n}\n```\n\n### Notes\n- This package is a DRF exception handler, so it standardizes errors that reach a DRF API view. That means it cannot\nhandle errors that happen at the middleware level for example. To handle those as well, you can customize\nthe necessary [django error views](https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views).\nYou can find more about that in [this issue](https://github.com/ghazi-git/drf-standardized-errors/issues/44).\n\n- Standardized error responses when `DEBUG=True` for **unhandled exceptions** are disabled by default. That is\nto allow you to get more information out of the traceback. You can enable standardized errors instead with:\n```python\nDRF_STANDARDIZED_ERRORS = {\"ENABLE_IN_DEBUG_FOR_UNHANDLED_EXCEPTIONS\": True}\n```\n\n## Integration with DRF spectacular\nIf you plan to use [drf-spectacular](https://github.com/tfranzel/drf-spectacular) to generate an OpenAPI 3 schema,\ninstall with `pip install drf-standardized-errors[openapi]`. After that, check the [doc page](https://drf-standardized-errors.readthedocs.io/en/latest/openapi.html)\nfor configuring the integration.\n\n## Links\n\n- Documentation: https://drf-standardized-errors.readthedocs.io/en/latest/\n- Changelog: https://github.com/ghazi-git/drf-standardized-errors/releases\n- Code \u0026 issues: https://github.com/ghazi-git/drf-standardized-errors\n- PyPI: https://pypi.org/project/drf-standardized-errors/\n\n\n## License\n\nThis project is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghazi-git%2Fdrf-standardized-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghazi-git%2Fdrf-standardized-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghazi-git%2Fdrf-standardized-errors/lists"}