File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def __str__(self) -> str:
2121 """Custom string representation to show a cleaner error message"""
2222 parts = [f"{ self .args [0 ]} " ]
2323
24- if self .status_code :
24+ if self .status_code is not None :
2525 parts .append (f"Status: { self .status_code } " )
2626
2727 if self .original_error and not isinstance (
Original file line number Diff line number Diff line change 1+ from hyperbrowser .exceptions import HyperbrowserError
2+
3+
4+ def test_hyperbrowser_error_str_includes_zero_status_code ():
5+ error = HyperbrowserError ("request failed" , status_code = 0 )
6+
7+ assert str (error ) == "request failed - Status: 0"
8+
9+
10+ def test_hyperbrowser_error_str_includes_original_error_details_once ():
11+ root_cause = ValueError ("boom" )
12+ error = HyperbrowserError ("request failed" , original_error = root_cause )
13+
14+ assert str (error ) == "request failed - Caused by ValueError: boom"
You can’t perform that action at this time.
0 commit comments