Skip to content

Commit

Permalink
Better error message for malformed wrap rules in Transform HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Nov 8, 2023
1 parent 292e4c9 commit cb1f70e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/calibre/ebooks/html_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}


Expand Down

0 comments on commit cb1f70e

Please sign in to comment.