Skip to content

Commit

Permalink
adding helpful error when a dataset fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
brimoor committed Aug 25, 2022
1 parent 6bedc9c commit ef536b1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fiftyone/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4910,6 +4910,25 @@ def _load_dataset(name, virtual=False):
if not virtual:
fomi.migrate_dataset_if_necessary(name)

try:
return _do_load_dataset(name, virtual=virtual)
except Exception as e:
try:
version = fomi.get_dataset_revision(name)
except:
raise e

if version != focn.VERSION:
raise ValueError(
"Failed to load dataset '%s' from v%s using client v%s. "
"You may need to upgrade your client"
% (name, version, focn.VERSION)
) from e

raise e


def _do_load_dataset(name, virtual=False):
try:
# pylint: disable=no-member
dataset_doc = foo.DatasetDocument.objects.get(name=name)
Expand Down Expand Up @@ -4968,6 +4987,7 @@ def _load_dataset(name, virtual=False):
]

dataset_doc.save()

return dataset_doc, sample_doc_cls, frame_doc_cls


Expand Down

0 comments on commit ef536b1

Please sign in to comment.