Skip to content

Commit

Permalink
Improve error messages for non-existing datasets
Browse files Browse the repository at this point in the history
Improve error messages in the `datasets ls` and `datasets cp` commands
when a given dataset doesn't exist.

Previously one would get variably misleading messages depending on the
degree of dataset/version/edition given. Now it gives a consistent
error message that the dataset doesn't exist when it doesn't.
  • Loading branch information
simenheg committed Feb 14, 2024
1 parent 4ca843e commit d8eabb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## ?.?.? - Unreleased

* Fixed extraneous newline printing in table output.
* Improved error messages in the `datasets ls` and `datasets cp` commands when a
given dataset doesn't exist.

## 3.2.0 - 2024-01-15

Expand Down
4 changes: 4 additions & 0 deletions okdata/cli/commands/datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ def _dataset_components_from_uri(
parts = dataset_uri.split("/")
dataset_id, version, edition = parts + [None] * (3 - len(parts))

# First verify that the dataset exists; `get_dataset` raises an error
# if not.
self.sdk.get_dataset(dataset_id)

if auto_resolve:
if not version:
version = self._get_latest_version(dataset_id)["version"]
Expand Down

0 comments on commit d8eabb5

Please sign in to comment.