File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ def __str__(self) -> str:
173173 # Lazy import to avoid a cyclic dependency between error and language
174174 from ..language .print_location import print_location , print_source_location
175175
176- output = [self .message ]
176+ output = [str ( self .message ) ]
177177
178178 if self .nodes :
179179 for node in self .nodes :
Original file line number Diff line number Diff line change @@ -351,6 +351,30 @@ def prints_an_error_with_nodes_from_different_sources():
351351 """
352352 )
353353
354+ def handles_proxy_error_messages ():
355+ class ProxyString :
356+ def __init__ (self , value ):
357+ self .value = value
358+
359+ def __str__ (self ):
360+ return self .value
361+
362+ error = GraphQLError (ProxyString ("Example error" )) # type: ignore
363+
364+ assert str (error ) == dedent (
365+ """
366+ Example error
367+ """
368+ )
369+
370+ error = GraphQLError (ValueError (ProxyString ("Example value error" ))) # type: ignore
371+
372+ assert str (error ) == dedent (
373+ """
374+ Example value error
375+ """
376+ )
377+
354378
355379def describe_formatted ():
356380 def deprecated_formats_an_error_using_format_error ():
You can’t perform that action at this time.
0 commit comments