Skip to content

Commit

Permalink
Merge pull request #168 from pescadores/exception-tracing
Browse files Browse the repository at this point in the history
Exception tracing
  • Loading branch information
bmcfee authored Jan 30, 2024
2 parents c7d92df + 8b645c8 commit 809b57f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
coverage.xml

# Translations
*.mo
Expand Down
12 changes: 6 additions & 6 deletions pescador/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def buffer_stream(stream, buffer_size, partial=False, axis=None):
continue
try:
yield __stack_data(data, axis=axis)
except (TypeError, AttributeError):
raise DataError(f"Malformed data stream: {data}")
except (TypeError, AttributeError) as ex:
raise DataError(f"Malformed data stream: {data}") from ex
finally:
data = []
count = 0
Expand Down Expand Up @@ -169,8 +169,8 @@ def tuples(stream, *keys):
for data in stream:
try:
yield tuple(data[key] for key in keys)
except TypeError:
raise DataError(f"Malformed data stream: {data}")
except TypeError as ex:
raise DataError(f"Malformed data stream: {data}") from ex


def keras_tuples(stream, inputs=None, outputs=None):
Expand Down Expand Up @@ -230,8 +230,8 @@ def keras_tuples(stream, inputs=None, outputs=None):
y = y[0]

yield (x, y)
except TypeError:
raise DataError(f"Malformed data stream: {data}")
except TypeError as ex:
raise DataError(f"Malformed data stream: {data}") from ex


def cache(stream, n_cache, prob=0.5, random_state=None):
Expand Down

0 comments on commit 809b57f

Please sign in to comment.