You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: raise proper error when UUID parsing fails (#1582)
* Do not raise AttributeError when parsing non-string UUIDs
When a user sends a dictionary or other object as a UUID variable like `{[123]}`, previously graphene crashed with an `AttributeError`, like this:
```
(…)
File "…/lib/python3.12/site-packages/graphql/utils/is_valid_value.py", line 78, in is_valid_value
parse_result = type.parse_value(value)
^^^^^^^^^^^^^^^^^^^^^^^
File "…/lib/python3.12/site-packages/graphene/types/uuid.py", line 33, in parse_value
return _UUID(value)
^^^^^^^^^^^^
File "/usr/lib/python3.12/uuid.py", line 175, in __init__
hex = hex.replace('urn:', '').replace('uuid:', '')
^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'replace'
```
But an `AttributeError` makes it seem like this is the server's fault, when it's obviously the client's.
Report a proper GraphQLError.
* fix: adjust exception message structure
---------
Co-authored-by: Erik Wrede <[email protected]>
0 commit comments