about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-01-10 04:19:49 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-01-10 07:35:51 +0900
commit0cc7358aea08073b7575ce35858191665bb9e264 (patch)
tree021cf5378d0480ccac5abe9efebae35b33a15ecb /src
parente440e799c139b967a88cacc298a8d0e735dcaff6 (diff)
downloadfead-0cc7358aea08073b7575ce35858191665bb9e264.tar.gz
Print URL to unparsable feed
Diffstat (limited to 'src')
-rwxr-xr-xsrc/fead.py5
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)