File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def located_error(
29
29
return original_error
30
30
try :
31
31
# noinspection PyUnresolvedReferences
32
- message = original_error .message # type: ignore
32
+ message = str ( original_error .message ) # type: ignore
33
33
except AttributeError :
34
34
message = str (original_error )
35
35
try :
Original file line number Diff line number Diff line change 2
2
3
3
from graphql .error import GraphQLError , located_error
4
4
5
+ from ..utils import dedent
6
+
5
7
6
8
def describe_located_error ():
7
9
def throws_without_an_original_error ():
@@ -23,3 +25,24 @@ def does_not_pass_through_elasticsearch_like_errors():
23
25
e = Exception ("I am from elasticsearch" )
24
26
cast (Any , e ).path = "/something/feed/_search"
25
27
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