File tree 2 files changed +25
-1
lines changed
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:
173
173
# Lazy import to avoid a cyclic dependency between error and language
174
174
from ..language .print_location import print_location , print_source_location
175
175
176
- output = [self .message ]
176
+ output = [str ( self .message ) ]
177
177
178
178
if self .nodes :
179
179
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():
351
351
"""
352
352
)
353
353
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 # noqa: E501
371
+
372
+ assert str (error ) == dedent (
373
+ """
374
+ Example value error
375
+ """
376
+ )
377
+
354
378
355
379
def describe_formatted ():
356
380
def deprecated_formats_an_error_using_format_error ():
You can’t perform that action at this time.
0 commit comments