Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
refactor: improve exception handling in create_task_with_error_handling
reformedote7b8f2987cf1
diff --git a/browser_use/utils.py b/browser_use/utils.pyindex 4a5602997..c7fe381bd 100644--- a/browser_use/utils.py+++ b/browser_use/utils.py@@ -712,12 +712,12 @@ def create_task_with_error_handling(if suppress_exceptions:log.error(f'Exception in background task [{task_name}]: {type(exc).__name__}: {exc}', exc_info=exc)else:- # Log at warning level when not suppressed - exception remains retrievable via task.exception()+ # Log at warning level then re-raise to propagate to event loop's exception handlerlog.warning(- f'Exception in background task [{task_name}]: {type(exc).__name__}: {exc} '- f'(exception retrievable via task.exception() if awaited)',+ f'Exception in background task [{task_name}]: {type(exc).__name__}: {exc}',exc_info=exc,)+ raise excexcept asyncio.CancelledError:# Task was cancelled, this is normal behaviorpass