Skip to content

Commit 6d6cb0f

Browse files
authored
utils/lxmlize: re-raise the original parse error instead of wrapping it (#5680)
`raise Exception(e)` after the log line widened the type to bare Exception and dropped the original traceback, so the scraper output showed `Exception('XMLSyntaxError(...)")'` instead of the actual parser error. Plain `raise` keeps the lxml exception and its full chain intact. Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
1 parent 61bf46b commit 6d6cb0f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scrapers/utils/lxmlize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def url_xpath(url, path, verify=None, user_agent=None):
1313
res = requests.get(url, verify=verify, headers=headers)
1414
try:
1515
doc = lxml.html.fromstring(res.text)
16-
except Exception as e:
16+
except Exception:
1717
logging.error(
1818
f"Failed to retrieve xpath from {url} :: returned:\n"
1919
f"CONTENT: {res.content} \n"
2020
f"RETURN CODE: {res.status_code}"
2121
)
22-
raise Exception(e)
22+
raise
2323
return doc.xpath(path)
2424

2525

0 commit comments

Comments
 (0)