Skip to content

Commit 2c45ec7

Browse files
committed
Now raising an exception if the feature schema is not successfully archived
1 parent 3548045 commit 2c45ec7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

labelbox/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ def get_catalog_slice(self, slice_id) -> CatalogSlice:
15811581
def unarchive_feature_schema_node(self, ontology_id: str,
15821582
root_feature_schema_id: str) -> bool:
15831583
"""
1584-
Returns true if the root feature schema node was successfully unarchived, false otherwise.
1584+
Returns true if the root feature schema node was successfully unarchived.
15851585
Only root level feature schema nodes can be unarchived.
15861586
Args:
15871587
root_feature_schema_id (str): The ID of the root level feature schema
@@ -1597,10 +1597,14 @@ def unarchive_feature_schema_node(self, ontology_id: str,
15971597
headers=self.headers,
15981598
)
15991599
if response.status_code == requests.codes.ok:
1600-
return response.json()['unarchived']
1600+
unarchived = bool(response.json()['unarchived'])
1601+
if (unarchived == False):
1602+
raise labelbox.exceptions.LabelboxError(
1603+
"Failed unarchive the feature schema.", response.text)
1604+
return unarchived
16011605
else:
16021606
raise labelbox.exceptions.LabelboxError(
1603-
"Failed unarchive root feature schema node, message: ",
1607+
"Failed unarchive the feature schema node, message: ",
16041608
response.text)
16051609

16061610
def get_model_slice(self, slice_id) -> ModelSlice:

0 commit comments

Comments
 (0)