From ee9fdb7ac7cc43b8c3829a3c88fecedef2045a39 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 28 Nov 2024 16:30:29 +0100 Subject: [PATCH] Clan-app/api: improve error message for mismatching types --- pkgs/clan-cli/clan_cli/api/serde.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/clan-cli/clan_cli/api/serde.py b/pkgs/clan-cli/clan_cli/api/serde.py index 84328186b..78de6a533 100644 --- a/pkgs/clan-cli/clan_cli/api/serde.py +++ b/pkgs/clan-cli/clan_cli/api/serde.py @@ -160,7 +160,7 @@ def construct_value( if loc is None: loc = [] if t is None and field_value: - msg = f"Expected None but got: {field_value}" + msg = f"Trying to construct field of type None. But got: {field_value}. loc: {loc}" raise ClanError(msg, location=f"{loc}") if is_type_in_union(t, type(None)) and field_value is None: @@ -319,4 +319,5 @@ def from_dict( msg = f"{data} is not a dict. Expected {t}" raise ClanError(msg) return construct_dataclass(t, data, path) # type: ignore + # breakpoint() return construct_value(t, data, path)