Skip to content

Commit 4010dd3

Browse files
author
Dave Berenbaum
authored
log_params: fix invalid type msg (#745)
1 parent f39c7e2 commit 4010dd3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/dvclive/error.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ def __init__(self, name):
2929

3030

3131
class InvalidParameterTypeError(DvcLiveError):
32-
def __init__(self, val: Any):
33-
self.val = val
34-
super().__init__(f"Parameter type {type(val)} is not supported.")
32+
def __init__(self, msg: Any):
33+
super().__init__(msg)
3534

3635

3736
class InvalidReportModeError(DvcLiveError):

src/dvclive/live.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def _dump_params(self):
454454
try:
455455
dump_yaml(self._params, self.params_file)
456456
except RepresenterError as exc:
457-
raise InvalidParameterTypeError(exc.args) from exc
457+
raise InvalidParameterTypeError(exc.args[0]) from exc
458458

459459
def log_params(self, params: Dict[str, ParamLike]):
460460
"""Saves the given set of parameters (dict) to yaml"""

tests/test_log_param.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,6 @@ class Dummy:
8484

8585
param_value = Dummy()
8686

87-
with pytest.raises(InvalidParameterTypeError):
87+
with pytest.raises(InvalidParameterTypeError) as excinfo:
8888
dvclive.log_param("param_complex", param_value)
89+
assert "Dummy" in excinfo.value.args[0]

0 commit comments

Comments
 (0)