This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
Cryptic error if permission directive returns non-bool #124
Labels
documentation
Improvements or additions to documentation
good first issue
Good for newcomers
help wanted
Extra attention is needed
If I have a permission directive (e.g. a class with
@gql.schema_directive(locations=[Location.FIELD_DEFINITION])
) for whichcheck_condition
returns a non-bool value (let's sayNone
) things may break badly.I'm getting 500 errors with the following stack trace:
Stack trace
The API is not super clear about this:
strawberry-django-plus/strawberry_django_plus/permissions.py
Lines 389 to 390 in b416aa2
Note how the return type is not documented.
I think the culprit is:
strawberry-django-plus/strawberry_django_plus/permissions.py
Lines 297 to 302 in b416aa2
Here if the value returned is not a boolean it assumes it is a future (which is not the case for
None
for example).I'm not saying this is a bug of this library, however the resulting error is very cryptic (and finding the root cause of the problem was quite hard as well). I'm proposing to at least document this behavior, and maybe add an assertion or a proper check for the values returned by
check_condition
. Isis_awaitable
really that slow?The text was updated successfully, but these errors were encountered: