Skip to content
Snippets Groups Projects
Commit 740fbd21 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

improve error messages

parent 1b3ce399
No related branches found
No related tags found
No related merge requests found
Pipeline #61048 passed
......@@ -193,19 +193,19 @@ def load(inputs):
if _is_string(inputs):
if not os.path.exists(inputs):
raise RuntimeError(f"`{inputs}' does not exist!")
return open_file(inputs)
try:
return open_file(inputs)
except Exception as e:
raise RuntimeError(f"Could not load `{inputs}'!") from e
elif isinstance(inputs, Iterable):
retval = []
for obj in inputs:
if _is_string(obj):
retval.append(load(obj))
# elif isinstance(obj, File):
# retval.append(obj.read())
else:
raise TypeError(
"Iterable contains an object which is not a filename nor a "
"bob.io.base.File."
"Iterable contains an object which is not a filename"
)
return numpy.vstack(retval)
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment