@@ -8,7 +8,7 @@ def _camelcased(value: str) -> str:
8
8
return capitalized [0 ].lower () + capitalized [1 :]
9
9
10
10
11
- # pylint: disable=too-many-arguments
11
+ # pylint: disable=too-many-arguments, import-outside-toplevel
12
12
class FabricError (Exception ):
13
13
context : dict [str , str ] | None
14
14
description : str
@@ -43,14 +43,16 @@ def __iter__(self):
43
43
"return_value" : self .return_value
44
44
}.items ()
45
45
46
- def __str__ (self ) -> str :
47
- return f'''
48
- { self .__class__ .__name__ } (name={ self .name } , context={ self .context } , description={ self .description } , \
49
- http_code={ self .http_code } , return_value={ self .return_value } )
50
- '''
51
-
52
46
def __repr__ (self ) -> str :
53
- return self .__str__ ()
47
+ from pprint import pformat
48
+ return f"{ self .__class__ .__name__ } (\n { pformat (dict (self ), width = 120 , sort_dicts = False )} \n )"
49
+
50
+ def __str__ (self ) -> str :
51
+ from pprint import pformat
52
+ string = f"{ self .name } - { self .description } "
53
+ if self .context :
54
+ string += f"\n context: { pformat (self .context , width = 160 , sort_dicts = False )} "
55
+ return string
54
56
55
57
def __sizeof__ (self ) -> int :
56
58
context_size = getsizeof (self .context ) if self .context else 0
0 commit comments