Skip to content

Commit

Permalink
Merge pull request #176 from segments-ai/fix/add-potential-fixes-for-…
Browse files Browse the repository at this point in the history
…not-found-error

fix: add potential fixes for not found error
  • Loading branch information
segments-arnaud committed May 1, 2024
2 parents 5d139e5 + 92c059c commit e824112
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/segments/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ def throw_segments_exception(
# Make string comparison case insensitive.
text = e.response.text.lower()
if "not found" in text or "does not exist" in text:
text += """\n
Possible fixes:
- Check for typos in the dataset name, sample name, labelset name, etc.
- Are you using the argument `dataset_name` -> Did you add the organization to the dataset name? E.g., `jane/flowers` instead of `flowers`.
"""
raise NotFoundError(message=text, cause=e)
if "already exists" in text or "already have" in text:
raise AlreadyExistsError(message=text, cause=e)
Expand Down

0 comments on commit e824112

Please sign in to comment.