Skip to content

Commit

Permalink
Add exception handling for type error
Browse files Browse the repository at this point in the history
  • Loading branch information
fliepeltje committed Mar 19, 2024
1 parent a4b5eb6 commit 135bcaf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion humitifier/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,19 @@ def from_sql_rows(cls, rows):
except Exception as e:
logger.info(f"Error parsing {name}: {e}")
create_args[name] = FactError(**data)
return cls(**create_args)
try:
return cls(**create_args)
except TypeError:
not_collected_fact_err = FactError(
stdout="",
stderr="",
exception="",
exit_code=0,
py_excpetion="Fact Not Collected",
)
err_args_base = {k: not_collected_fact_err for k in cls.__annotations__}
err_args = {**err_args_base, **create_args}
return cls(**err_args)


@dataclass
Expand Down

0 comments on commit 135bcaf

Please sign in to comment.