diff --git a/packages/toolbox-core/src/toolbox_core/protocol.py b/packages/toolbox-core/src/toolbox_core/protocol.py index 6606ef93..b101c9b8 100644 --- a/packages/toolbox-core/src/toolbox_core/protocol.py +++ b/packages/toolbox-core/src/toolbox_core/protocol.py @@ -42,7 +42,7 @@ def __get_type(self) -> Type: base_type = bool elif self.type == "array": if self.items is None: - raise Exception("Unexpected value: type is 'list' but items is None") + raise ValueError("Unexpected value: type is 'array' but items is None") base_type = list[self.items.__get_type()] # type: ignore else: raise ValueError(f"Unsupported schema type: {self.type}") diff --git a/packages/toolbox-core/tests/test_protocol.py b/packages/toolbox-core/tests/test_protocol.py index b7650792..c2b4096d 100644 --- a/packages/toolbox-core/tests/test_protocol.py +++ b/packages/toolbox-core/tests/test_protocol.py @@ -86,11 +86,11 @@ def test_parameter_schema_array_no_items_error(): name="bad_list", type="array", description="List without item type" ) - expected_error_msg = "Unexpected value: type is 'list' but items is None" - with pytest.raises(Exception, match=expected_error_msg): + expected_error_msg = "Unexpected value: type is 'array' but items is None" + with pytest.raises(ValueError, match=expected_error_msg): schema._ParameterSchema__get_type() - with pytest.raises(Exception, match=expected_error_msg): + with pytest.raises(ValueError, match=expected_error_msg): schema.to_param()