Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info to ValueErrors for np.frombuffer #244

Merged
merged 1 commit into from
Mar 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions strax/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ def _load_file(f, compressor, dtype):
return np.zeros(0, dtype=dtype)

data = COMPRESSORS[compressor]['decompress'](data)
return np.frombuffer(data, dtype=dtype)

try:
return np.frombuffer(data, dtype=dtype)
except ValueError as e:
raise ValueError(f"ValueError while loading data with dtype =\n\t{dtype}") from e

except Exception:
raise strax.DataCorrupted(
f"Fatal Error while reading file {f}: "
Expand Down