diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-13 14:43:26 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-13 14:43:26 -0500 |
| commit | 55f676da16691c7eb23f1ffcb3b589dc3842b274 (patch) | |
| tree | 98afaf46f17ff3c01bece44bf412390808539587 /Biz/PodcastItLater/Admin.py | |
| parent | 81c46826005a60018c2a4f31675ba1f5eff1c7d8 (diff) | |
Replace bare exception catches with specific exceptions
- Replace Exception with httpx.HTTPError, httpx.TimeoutException,
re.error in extract_og_metadata - Replace Exception with ValueError,
KeyError in auth verification - Replace Exception with httpx errors
and ValueError in submit_article - Replace Exception with ValueError,
KeyError, AttributeError in RSS feed generation - Replace Exception
with ValueError, KeyError in cancel/retry/delete job handlers
Improves error handling specificity and removes BLE001 linter
suppressions.
Amp-Thread-ID:
https://ampcode.com/threads/T-8edacbeb-b343-49ca-b524-1c999272acb6
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Biz/PodcastItLater/Admin.py')
| -rw-r--r-- | Biz/PodcastItLater/Admin.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Biz/PodcastItLater/Admin.py b/Biz/PodcastItLater/Admin.py index 4920b39..6892234 100644 --- a/Biz/PodcastItLater/Admin.py +++ b/Biz/PodcastItLater/Admin.py @@ -615,7 +615,7 @@ def retry_queue_item(request: Request, job_id: int) -> Response: status_code=200, headers={"HX-Redirect": "/admin"}, ) - except Exception as e: # noqa: BLE001 + except (ValueError, KeyError) as e: return Response( f"Error retrying job: {e!s}", status_code=500, @@ -643,7 +643,7 @@ def delete_queue_item(request: Request, job_id: int) -> Response: status_code=200, headers={"HX-Redirect": "/admin"}, ) - except Exception as e: # noqa: BLE001 + except (ValueError, KeyError) as e: return Response( f"Error deleting job: {e!s}", status_code=500, |
