remove exc_info from LOG.exception (#246)

This commit is contained in:
Shuchang Zheng
2024-04-30 00:27:32 -07:00
committed by GitHub
parent 45d11e5a7f
commit b6a85cf3a5
8 changed files with 20 additions and 22 deletions

View File

@@ -228,7 +228,9 @@ async def handle_download_file_action(
await download.save_as(full_file_path)
except Exception as e:
LOG.exception(
"DownloadFileAction: Failed to download file", action=action, full_file_path=full_file_path, exc_info=True
"DownloadFileAction: Failed to download file",
action=action,
full_file_path=full_file_path,
)
return [ActionFailure(e)]
@@ -363,7 +365,7 @@ async def handle_select_option_action(
if action.option.index is not None:
LOG.warning(
"Failed to click on the option by label, trying by index",
exc_info=e,
exc_info=True,
action=action,
xpath=xpath,
)
@@ -667,7 +669,7 @@ async def click_sibling_of_input(
interacted_with_sibling=True,
)
except Exception as e:
LOG.warning("Failed to click sibling label of input element", exc_info=e)
LOG.warning("Failed to click sibling label of input element", exc_info=True)
return ActionFailure(exception=e, javascript_triggered=javascript_triggered)

View File

@@ -181,7 +181,7 @@ class BrowserState:
await self.page.goto(url)
await asyncio.sleep(3)
except Error as playright_error:
LOG.exception(f"Error while navigating to url: {str(playright_error)}", exc_info=True)
LOG.exception(f"Error while navigating to url: {str(playright_error)}")
raise FailedToNavigateToUrl(url=url, error_message=str(playright_error))
success = True
LOG.info(f"Successfully went to {url}")
@@ -190,13 +190,12 @@ class BrowserState:
except Exception as e:
LOG.exception(
f"Error while creating or navigating to a new page. Waiting for 5 seconds. Error: {str(e)}",
exc_info=True,
)
retries += 1
# Wait for 5 seconds before retrying
await asyncio.sleep(5)
if retries >= 3:
LOG.exception(f"Failed to create a new page after 3 retries: {str(e)}", exc_info=True)
LOG.exception(f"Failed to create a new page after 3 retries: {str(e)}")
raise e
LOG.info(f"Retrying to create a new page. Retry count: {retries}")
@@ -236,8 +235,8 @@ class BrowserState:
animations="disabled",
)
except TimeoutError as e:
LOG.exception(f"Timeout error while taking screenshot: {str(e)}", exc_info=True)
LOG.exception(f"Timeout error while taking screenshot: {str(e)}")
raise FailedToTakeScreenshot(error_message=str(e)) from e
except Exception as e:
LOG.exception(f"Unknown error while taking screenshot: {str(e)}", exc_info=True)
LOG.exception(f"Unknown error while taking screenshot: {str(e)}")
raise FailedToTakeScreenshot(error_message=str(e)) from e

View File

@@ -49,7 +49,7 @@ def load_js_script() -> str:
with open(path, "r") as f:
return f.read()
except FileNotFoundError as e:
LOG.exception("Failed to load the JS script", exc_info=True, path=path)
LOG.exception("Failed to load the JS script", path=path)
raise e