Skip to content
Snippets Groups Projects
Commit 989c00e4 authored by Leon Mauritz Möller's avatar Leon Mauritz Möller Committed by Michael Thies
Browse files

adapter.http: get root cause in parse_request_body()

for better error messages
parent b5e31f90
No related branches found
No related tags found
No related merge requests found
...@@ -256,6 +256,8 @@ def parse_request_body(request: Request, expect_type: Type[T]) -> T: ...@@ -256,6 +256,8 @@ def parse_request_body(request: Request, expect_type: Type[T]) -> T:
xml_data = io.BytesIO(request.get_data()) xml_data = io.BytesIO(request.get_data())
rv = read_aas_xml_element(xml_data, type_constructables_map[expect_type], stripped=True, failsafe=False) rv = read_aas_xml_element(xml_data, type_constructables_map[expect_type], stripped=True, failsafe=False)
except (KeyError, ValueError, TypeError, json.JSONDecodeError, etree.XMLSyntaxError) as e: except (KeyError, ValueError, TypeError, json.JSONDecodeError, etree.XMLSyntaxError) as e:
while e.__cause__ is not None:
e = e.__cause__
raise BadRequest(str(e)) from e raise BadRequest(str(e)) from e
assert isinstance(rv, expect_type) assert isinstance(rv, expect_type)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment