File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def test_uuidstring_invalid_argument():
4747 assert len (result .errors ) == 1
4848 assert (
4949 result .errors [0 ].message
50- == "Variable '$uuid' got invalid value {'not': 'a string'}; UUID must be a string"
50+ == "Variable '$uuid' got invalid value {'not': 'a string'}; UUID cannot represent value: {'not': ' a string'} "
5151 )
5252
5353
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ def parse_literal(node, _variables=None):
2929
3030 @staticmethod
3131 def parse_value (value ):
32- if not isinstance (value , (str , _UUID )):
33- raise GraphQLError ("UUID must be a string" )
34- return _UUID (value )
32+ if isinstance (value , _UUID ):
33+ return value
34+ try :
35+ return _UUID (value )
36+ except (ValueError , AttributeError ):
37+ raise GraphQLError (f"UUID cannot represent value: { repr (value )} " )
You can’t perform that action at this time.
0 commit comments