@@ -8,7 +8,7 @@ def _camelcased(value: str) -> str:
88 return capitalized [0 ].lower () + capitalized [1 :]
99
1010
11- # pylint: disable=too-many-arguments
11+ # pylint: disable=too-many-arguments, import-outside-toplevel
1212class FabricError (Exception ):
1313 context : dict [str , str ] | None
1414 description : str
@@ -43,14 +43,16 @@ def __iter__(self):
4343 "return_value" : self .return_value
4444 }.items ()
4545
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-
5246 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
5456
5557 def __sizeof__ (self ) -> int :
5658 context_size = getsizeof (self .context ) if self .context else 0
0 commit comments