From 3df3d1059c6b0c0fbf9919b36ca6b0f2163c4fb7 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 14 Jun 2023 08:54:03 +0200 Subject: [PATCH] lcl: screenshot when error --- ofx_processor/downloaders/lcl.py | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ofx_processor/downloaders/lcl.py b/ofx_processor/downloaders/lcl.py index 28b8ba4..0222c40 100644 --- a/ofx_processor/downloaders/lcl.py +++ b/ofx_processor/downloaders/lcl.py @@ -1,3 +1,4 @@ +import os import time from pathlib import Path @@ -35,6 +36,14 @@ class LclDownloader: self.selenium.implicitly_wait(30) def download(self) -> str: + try: + return self._download() + except Exception: + screenshot = Path(os.getenv("SCREENSHOT_DIR", default="/tmp")) / "error_download.png" + self.selenium.save_screenshot(screenshot) + raise + + def _download(self) -> str: selenium = self.selenium click.secho("Logging in to LCL...", fg="blue") diff --git a/pyproject.toml b/pyproject.toml index bd4749a..e1ab074 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ofx-processor" -version = "4.4.2" +version = "4.4.3" description = "Personal ofx processor" readme = "README.md" authors = ["Gabriel Augendre "]