File tree Expand file tree Collapse file tree
hyperbrowser/client/managers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ def parse_response_model(
6161 raise
6262 except Exception as exc :
6363 raise HyperbrowserError (
64- f"Failed to read { normalized_operation_name } response data " ,
64+ f"Failed to read { normalized_operation_name } response keys " ,
6565 original_error = exc ,
6666 ) from exc
6767 for key in response_keys :
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ def test_parse_response_model_truncates_operation_name_in_errors():
226226def test_parse_response_model_wraps_mapping_read_failures ():
227227 with pytest .raises (
228228 HyperbrowserError ,
229- match = "Failed to read basic operation response data " ,
229+ match = "Failed to read basic operation response keys " ,
230230 ) as exc_info :
231231 parse_response_model (
232232 _BrokenMapping ({"success" : True }),
@@ -237,6 +237,27 @@ def test_parse_response_model_wraps_mapping_read_failures():
237237 assert exc_info .value .original_error is not None
238238
239239
240+ def test_parse_response_model_preserves_hyperbrowser_key_read_failures ():
241+ class _BrokenMapping (Mapping [str , object ]):
242+ def __iter__ (self ):
243+ raise HyperbrowserError ("custom key read failure" )
244+
245+ def __len__ (self ) -> int :
246+ return 1
247+
248+ def __getitem__ (self , key : str ) -> object :
249+ return key
250+
251+ with pytest .raises (HyperbrowserError , match = "custom key read failure" ) as exc_info :
252+ parse_response_model (
253+ _BrokenMapping (),
254+ model = BasicResponse ,
255+ operation_name = "basic operation" ,
256+ )
257+
258+ assert exc_info .value .original_error is None
259+
260+
240261def test_parse_response_model_wraps_mapping_value_read_failures ():
241262 with pytest .raises (
242263 HyperbrowserError ,
You can’t perform that action at this time.
0 commit comments