diff options
author | Nguyễn Gia Phong <cnx@loang.net> | 2024-01-10 04:19:49 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <cnx@loang.net> | 2024-01-10 07:35:51 +0900 |
commit | 0cc7358aea08073b7575ce35858191665bb9e264 (patch) | |
tree | 021cf5378d0480ccac5abe9efebae35b33a15ecb | |
parent | e440e799c139b967a88cacc298a8d0e735dcaff6 (diff) | |
download | fead-0cc7358aea08073b7575ce35858191665bb9e264.tar.gz |
Print URL to unparsable feed
-rwxr-xr-x | src/fead.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fead.py b/src/fead.py index 5987020..5c42116 100755 --- a/src/fead.py +++ b/src/fead.py @@ -171,7 +171,10 @@ async def fetch(raw_url): type('RedirectWarning', (Warning,), {})) return await fetch(location) if response.status >= 200: - xml = parse_xml(response.read()) + try: + xml = parse_xml(response.read()) + except SyntaxError as e: + raise ValueError(f'malformed XML at {raw_url}') from e if xml.tag == 'rss': assert xml[0].tag == 'channel' src_title, src_link, items = parse_rss(xml[0], url.hostname) |