Skip to content

Commit dbb0e02

Browse files
Document specialized polling error handling in README
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent af53b2a commit dbb0e02

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,33 @@ with Hyperbrowser(api_key="your_api_key") as client:
102102
## Error handling
103103

104104
SDK errors are raised as `HyperbrowserError`.
105+
Polling timeouts and repeated polling failures are surfaced as:
106+
107+
- `HyperbrowserTimeoutError`
108+
- `HyperbrowserPollingError`
105109

106110
```python
107111
from hyperbrowser import Hyperbrowser
108-
from hyperbrowser.exceptions import HyperbrowserError
112+
from hyperbrowser.exceptions import (
113+
HyperbrowserError,
114+
HyperbrowserTimeoutError,
115+
)
116+
from hyperbrowser.models import StartScrapeJobParams
109117

110118
try:
111119
with Hyperbrowser(api_key="invalid") as client:
112120
client.team.get_credit_info()
113121
except HyperbrowserError as exc:
114122
print(exc)
123+
124+
try:
125+
with Hyperbrowser(api_key="your_api_key") as client:
126+
client.scrape.start_and_wait(
127+
StartScrapeJobParams(url="https://example.com"),
128+
max_wait_seconds=5,
129+
)
130+
except HyperbrowserTimeoutError:
131+
print("Scrape job timed out")
115132
```
116133

117134
## Development

0 commit comments

Comments
 (0)