Skip to content

Commit 81af1cd

Browse files
mrobers1982claude
andauthored
Fix foundry _get_app to raise ResourceNotFoundError for missing apps (#2065)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8ca13bd commit 81af1cd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

libs/labelbox/src/labelbox/schema/foundry/foundry_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ def _get_app(self, id: str) -> App:
5555
response = self.client.execute(query_str, params)
5656
except exceptions.InvalidQueryError:
5757
raise exceptions.ResourceNotFoundError(App, params)
58+
except exceptions.LabelboxError as e:
59+
# A missing app used to surface as InvalidQueryError; the API now
60+
# returns a generic "not found" LabelboxError instead. Map it back
61+
# to ResourceNotFoundError to preserve this method's contract.
62+
if "not found" in str(e).lower():
63+
raise exceptions.ResourceNotFoundError(App, params)
64+
raise exceptions.LabelboxError(f"Unable to get app with id {id}", e)
5865
except Exception as e:
5966
raise exceptions.LabelboxError(f"Unable to get app with id {id}", e)
6067
return App(**response["findModelFoundryApp"])

0 commit comments

Comments
 (0)