summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/Web.py
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/PodcastItLater/Web.py')
-rw-r--r--Biz/PodcastItLater/Web.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py
index 27b75dd..3524be8 100644
--- a/Biz/PodcastItLater/Web.py
+++ b/Biz/PodcastItLater/Web.py
@@ -159,7 +159,7 @@ def extract_og_metadata(url: str) -> tuple[str | None, str | None]:
if author:
author = html_module.unescape(author)
- except Exception as e: # noqa: BLE001
+ except (httpx.HTTPError, httpx.TimeoutException, re.error) as e:
logger.warning("Failed to extract metadata from %s: %s", url, e)
return None, None
else:
@@ -1113,7 +1113,8 @@ def verify_magic_link(request: Request) -> Response:
return RedirectResponse("/")
- except Exception: # noqa: BLE001
+ except (ValueError, KeyError):
+ # Token is invalid or expired
return RedirectResponse("/?error=expired_link")
@@ -1288,7 +1289,7 @@ def submit_article(request: Request, data: FormData) -> html.div: # noqa: PLR09
classes=["alert", "alert-success"],
)
- except Exception as e: # noqa: BLE001
+ except (httpx.HTTPError, httpx.TimeoutException, ValueError) as e:
return html.div(
html.i(classes=["bi", "bi-exclamation-triangle", "me-2"]),
f"Error: {e!s}",
@@ -1343,7 +1344,7 @@ def rss_feed(request: Request, token: str) -> Response: # noqa: ARG001
media_type="application/rss+xml; charset=utf-8",
)
- except Exception as e: # noqa: BLE001
+ except (ValueError, KeyError, AttributeError) as e:
return Response(f"Error generating feed: {e}", status_code=500)
@@ -1473,7 +1474,7 @@ def cancel_queue_item(request: Request, job_id: int) -> Response:
status_code=200,
headers={"HX-Trigger": "queue-updated"},
)
- except Exception as e: # noqa: BLE001
+ except (ValueError, KeyError) as e:
return Response(
f"Error cancelling job: {e!s}",
status_code=500,