Skip to content

Commit e3eb576

Browse files
authored
Merge pull request #315 from Labelbox/ms/improved-error-message
better error message when schema ids are none
2 parents 05d6e54 + 703cf81 commit e3eb576

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

labelbox/data/ontology.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def get_feature_schema_lookup(
1414

1515
def flatten_classification(classifications):
1616
for classification in classifications:
17+
if classification.feature_schema_id is None:
18+
raise ValueError(
19+
f"feature_schema_id cannot be None for classification `{classification.name}`."
20+
)
1721
if isinstance(classification, ontology.Classification):
1822
classification_lookup[
1923
classification.
@@ -28,6 +32,9 @@ def flatten_classification(classifications):
2832
flatten_classification(classification.options)
2933

3034
for tool in ontology_builder.tools:
35+
if tool.feature_schema_id is None:
36+
raise ValueError(
37+
f"feature_schema_id cannot be None for tool `{tool.name}`.")
3138
tool_lookup[tool.name] = tool.feature_schema_id
3239
flatten_classification(tool.classifications)
3340
flatten_classification(ontology_builder.classifications)

0 commit comments

Comments
 (0)