File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ def validate_timeout_seconds(timeout: Optional[float]) -> Optional[float]:
1717 try :
1818 normalized_timeout = float (timeout )
1919 except (TypeError , ValueError , OverflowError ) as exc :
20- raise HyperbrowserError ("timeout must be finite" ) from exc
20+ raise HyperbrowserError (
21+ "timeout must be finite" ,
22+ original_error = exc ,
23+ ) from exc
2124 try :
2225 is_finite = math .isfinite (normalized_timeout )
2326 except (TypeError , ValueError , OverflowError ):
Original file line number Diff line number Diff line change @@ -119,10 +119,14 @@ def test_async_client_rejects_non_finite_timeout(invalid_timeout: float):
119119
120120
121121def test_sync_client_rejects_overflowing_real_timeout ():
122- with pytest .raises (HyperbrowserError , match = "timeout must be finite" ):
122+ with pytest .raises (HyperbrowserError , match = "timeout must be finite" ) as exc_info :
123123 Hyperbrowser (api_key = "test-key" , timeout = Fraction (10 ** 1000 , 1 ))
124124
125+ assert exc_info .value .original_error is not None
126+
125127
126128def test_async_client_rejects_overflowing_real_timeout ():
127- with pytest .raises (HyperbrowserError , match = "timeout must be finite" ):
129+ with pytest .raises (HyperbrowserError , match = "timeout must be finite" ) as exc_info :
128130 AsyncHyperbrowser (api_key = "test-key" , timeout = Fraction (10 ** 1000 , 1 ))
131+
132+ assert exc_info .value .original_error is not None
You can’t perform that action at this time.
0 commit comments