Skip to content

Commit 82ecb88

Browse files
committed
Convert ParseError instead of createing a new one whole-cloth.
1 parent d4bd910 commit 82ecb88

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

aws_doc_sdk_examples_tools/doc_gen_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,4 @@ def test_invalid_xml():
324324
first_error.value
325325
== "<fake><para>Certain characters like < are invalid</para></fake>"
326326
)
327-
assert (
328-
first_error.message()
329-
== "ParseError('not well-formed (invalid token): line 1, column 37')"
330-
)
327+
assert first_error.message() == "not well-formed (invalid token): line 1, column 37"

aws_doc_sdk_examples_tools/metadata_validator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
32
# SPDX-License-Identifier: Apache-2.0
43

@@ -174,7 +173,7 @@ def _validate_aws_entity_usage(value: str) -> bool:
174173
try:
175174
xtree = xml_tree.fromstring(xml_str)
176175
except ParseError as e:
177-
raise ElementTreeParseError(message=repr(e), raw=xml_str)
176+
raise ElementTreeParseError(message=f"{e}", raw=xml_str) from e
178177
blocks = (
179178
xtree.findall(".//programlisting")
180179
+ xtree.findall(".//code")

0 commit comments

Comments
 (0)