mirror of
https://github.com/daijro/camoufox.git
synced 2026-08-18 16:00:58 +00:00
Merge pull request #251 from wv-opt-ai/patch-1
Fix cleanup on exception in sync_api __enter__
This commit is contained in:
@@ -26,7 +26,11 @@ class Camoufox(PlaywrightContextManager):
|
||||
|
||||
def __enter__(self) -> Union[Browser, BrowserContext]:
|
||||
super().__enter__()
|
||||
self.browser = NewBrowser(self._playwright, **self.launch_options)
|
||||
try:
|
||||
self.browser = NewBrowser(self._playwright, **self.launch_options)
|
||||
except camoufox.exceptions.InvalidProxy as e:
|
||||
super().__exit__(camoufox.exceptions.InvalidProxy, e, None)
|
||||
raise
|
||||
return self.browser
|
||||
|
||||
def __exit__(self, *args: Any):
|
||||
|
||||
Reference in New Issue
Block a user