Skip to content

Commit 028ef73

Browse files
committed
attempt 4
1 parent 60b7ed6 commit 028ef73

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/reactpy/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ def string_to_reactpy(
118118
recover=not strict,
119119
),
120120
)
121-
except etree.XMLSyntaxError as e:
121+
except Exception as e:
122122
msg = (
123123
"An error has occurred while parsing the HTML.\n\n"
124-
"This HTML may be malformatted, or may not perfectly adhere to HTML5.\n"
124+
"This HTML may be malformatted, or may not adhere to the HTML5 spec.\n"
125125
"If you believe the exception above was due to something intentional, you "
126126
"can disable the strict parameter on string_to_reactpy().\n"
127127
"Otherwise, repair your broken HTML and try again."

tests/test_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,12 @@ def make_links_blue(node):
260260

261261

262262
def test_non_html_tag_behavior():
263-
source = "<ABC data-x=something><my-other-tag key=a-key /></ABC>"
263+
source = (
264+
"<my-tag data-x=something> </broken-tag> <my-other-tag key=a-key /> </my-tag>"
265+
)
264266

265267
expected = {
266-
"tagName": "abc",
268+
"tagName": "my-tag",
267269
"attributes": {"data-x": "something"},
268270
"children": [
269271
{"tagName": "my-other-tag", "attributes": {"key": "a-key"}, "key": "a-key"},

0 commit comments

Comments
 (0)