-
-
Notifications
You must be signed in to change notification settings - Fork 146
Description
Currently (in documentation) we have a nice way to handle error, particulary using @strawberry_django.mutation(handle_django_errors=True) or setting Global via settings.py
This feature is good, but It will nice if have the same way in query.
For example, if we apply IsAuthenticated instead of returning an empty data like
{
"data": {
"sectors": {
"pageInfo": {
"offset": 0,
"limit": 20
},
"totalCount": 0,
"results": []
}
}
}
I think it will be nice return error instead ie
{
"data": {
"sectors": {
"messages": [
{
"kind": "PERMISSION",
"message": "User is not authenticated.",
"field": "sectors",
"code": null
}
]
}
}
}
That mean, to have an option to supply ie handle_django_exceptions (at least for now), so we have a meaningful message to user about why getting empty data (as shown above)
PoC
- Using offset_paginated
sectors: OffsetPaginated[types.SectorType] = offset_paginated(handle_django_exceptions=True, extensions=[IsAuthenticated()])
- Using field
@strawberry_django.field(handle_django_exceptions=True, extensions=[IsAuthenticated()]))
Feature Request Type
- New behavior