graphql-python / graphql-python/graphene-django

Customizable ErrorType

Open
#1,154 0 comments 0 reactions 0 assignees View on GitHub
✨enhancement
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Currently, the ErrorType is hardcoded trying to override it for your own mutations is possible, however, it can neither be named ErrorType (graphene reduction on types will generate a clash of type names), nor will it be used by 3rd party code.

This means we can't intercept validation errors to for example change `__all__` to None, or align database field names with names used in the frontend. Additionally, using it for other error sources we can add extra `from_*` factories and keep things neatly in once place.

**Describe the solution you'd like**
ErrorType is a not a complex class and so being able to specify the class used, similar to AUTH_USER_MODEL (but without the added complexity of model swapping) would make the above possible.

**Describe alternatives you've considered**
Adding a CustomErrorType in own code, but when combined with graphene_django code that generates the "different types with same name" problem.
Also considered monkey patching, but not a good solution by nature.

**Additional context**
Can't think of anything else.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.