File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def located_error(
2929 return original_error
3030 try :
3131 # noinspection PyUnresolvedReferences
32- message = original_error .message # type: ignore
32+ message = str ( original_error .message ) # type: ignore
3333 except AttributeError :
3434 message = str (original_error )
3535 try :
Original file line number Diff line number Diff line change 22
33from graphql .error import GraphQLError , located_error
44
5+ from ..utils import dedent
6+
57
68def describe_located_error ():
79 def throws_without_an_original_error ():
@@ -23,3 +25,24 @@ def does_not_pass_through_elasticsearch_like_errors():
2325 e = Exception ("I am from elasticsearch" )
2426 cast (Any , e ).path = "/something/feed/_search"
2527 assert located_error (e , [], []) is not e
28+
29+ def handles_proxy_error_messages ():
30+ class ProxyString :
31+ def __init__ (self , value ):
32+ self .value = value
33+
34+ def __str__ (self ):
35+ return self .value
36+
37+ class MyError (Exception ):
38+ def __init__ (self ):
39+ self .message = ProxyString ("Example error" )
40+ super ().__init__ ()
41+
42+ error = located_error (MyError (), [], [])
43+
44+ assert str (error ) == dedent (
45+ """
46+ Example error
47+ """
48+ )
You can’t perform that action at this time.
0 commit comments