Better error message for malformed wrap rules in Transform HTML

This commit is contained in:
Kovid Goyal 2023-11-08 08:32:58 +05:30
parent 292e4c9da8
commit cb1f70e816
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -243,7 +243,10 @@ def empty(tag):
def parse_start_tag(text):
tag = parse(text, namespace_elements=True, fragment_context='div')[0]
try:
tag = parse(text, namespace_elements=True, fragment_context='div')[0]
except IndexError as e:
raise ValueError(_('No tag found in: {}. The tag specification must be of the form <tag> for example: <p>')) from e
return {'tag': tag.tag, 'attrib': tag.items()}