提交 c2e88c6e authored 作者: ricardoV94's avatar ricardoV94 提交者: Ricardo Vieira

Don't raise raw Exception in eval

上级 f2ad711f
...@@ -622,9 +622,9 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]): ...@@ -622,9 +622,9 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]):
if isinstance(key, str): if isinstance(key, str):
matching_vars = get_var_by_name([self], key) matching_vars = get_var_by_name([self], key)
if not matching_vars: if not matching_vars:
raise Exception(f"{key} not found in graph") raise ValueError(f"{key} not found in graph")
elif len(matching_vars) > 1: elif len(matching_vars) > 1:
raise Exception(f"Found multiple variables with name {key}") raise ValueError(f"Found multiple variables with name {key}")
new_input_to_values[matching_vars[0]] = value new_input_to_values[matching_vars[0]] = value
else: else:
new_input_to_values[key] = value new_input_to_values[key] = value
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论