Skip to content

Commit a7500e4

Browse files
committed
attempt 2
1 parent a8f7f8a commit a7500e4

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/reactpy/utils.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,17 @@ def string_to_reactpy(
118118
recover=not strict,
119119
),
120120
)
121+
return _etree_to_vdom(root_node, transforms, intercept_links)
121122
except etree.XMLSyntaxError as e:
122-
if not strict:
123-
raise e # nocov
124-
msg = (
125-
"An error has occurred while parsing the HTML.\n\n"
126-
"This HTML may be malformatted, or may not perfectly adhere to HTML5.\n"
127-
"If you believe the exception above was due to something intentional, you "
128-
"can disable the strict parameter on string_to_reactpy().\n"
129-
"Otherwise, repair your broken HTML and try again."
130-
)
131-
raise HTMLParseError(msg) from e
132-
133-
return _etree_to_vdom(root_node, transforms, intercept_links)
123+
if strict:
124+
msg = (
125+
"An error has occurred while parsing the HTML.\n\n"
126+
"This HTML may be malformatted, or may not perfectly adhere to HTML5.\n"
127+
"If you believe the exception above was due to something intentional, you "
128+
"can disable the strict parameter on string_to_reactpy().\n"
129+
"Otherwise, repair your broken HTML and try again."
130+
)
131+
raise HTMLParseError(msg) from e
134132

135133

136134
class HTMLParseError(etree.LxmlSyntaxError): # type: ignore[misc]

0 commit comments

Comments
 (0)