File tree 2 files changed +8
-19
lines changed
2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 11
11
12
12
def located_error (
13
13
original_error : Exception ,
14
- nodes : Optional [Union ["None" , Collection ["Node" ]]],
14
+ nodes : Optional [Union ["None" , Collection ["Node" ]]] = None ,
15
15
path : Optional [Collection [Union [str , int ]]] = None ,
16
16
) -> GraphQLError :
17
17
"""Located GraphQL Error
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
-
7
5
8
6
def describe_located_error ():
9
7
def throws_without_an_original_error ():
@@ -26,23 +24,14 @@ def does_not_pass_through_elasticsearch_like_errors():
26
24
cast (Any , e ).path = "/something/feed/_search"
27
25
assert located_error (e , [], []) is not e
28
26
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
27
+ def handles_lazy_error_messages ():
28
+ class LazyString :
29
+ def __str__ (self ) -> str :
30
+ return "lazy"
36
31
37
- class MyError (Exception ):
32
+ class LazyError (Exception ):
38
33
def __init__ (self ):
39
- self .message = ProxyString ( "Example error" )
34
+ self .message = LazyString ( )
40
35
super ().__init__ ()
41
36
42
- error = located_error (MyError (), [], [])
43
-
44
- assert str (error ) == dedent (
45
- """
46
- Example error
47
- """
48
- )
37
+ assert str (located_error (LazyError ())) == "lazy"
You can’t perform that action at this time.
0 commit comments