Skip to content

Commit

Permalink
[SDK] Raise more human-readable name conflict exception
Browse files Browse the repository at this point in the history
Co-authored-by: andreafehrman <[email protected]>
Co-authored-by: harrisonfritz <[email protected]>
  • Loading branch information
3 people committed Aug 8, 2023
1 parent 888bec3 commit d3d4c65
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/python/v1beta1/kubeflow/katib/api/katib_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def create_experiment(
raise TimeoutError(
f"Timeout to create Katib Experiment: {namespace}/{experiment.metadata.name}"
)
except Exception:
except Exception as e:
if hasattr(e, "status") and e.status == 409:
raise Exception(
f"A Katib Experiment with the name {namespace}/{experiment.metadata.name} already exists."
)
raise RuntimeError(
f"Failed to create Katib Experiment: {namespace}/{experiment.metadata.name}"
)
Expand Down

0 comments on commit d3d4c65

Please sign in to comment.