From d00cc3f6234803a753c01ef3b652bf5ab0d1a49d Mon Sep 17 00:00:00 2001 From: Xing Han Lu <21180505+xhluca@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:01:05 -0400 Subject: [PATCH] Update format.py (#23) --- weblinx/utils/format.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weblinx/utils/format.py b/weblinx/utils/format.py index 87b2bf5..184ee11 100644 --- a/weblinx/utils/format.py +++ b/weblinx/utils/format.py @@ -468,6 +468,8 @@ def format_uid(turn, uid_key="data-webtasks-id", return_as="dict"): formatted : str or dict A string or dictionary representing the uid. """ + if turn.element is None: + raise ValueError(f"format_uid received a turn object with turn.element missing (None): {turn}") output = {"uid": turn.element.get("attributes", {}).get(uid_key, None)} return format_output_dictionary(output, return_as=return_as)