Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions kafka/protocol/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
def _pack(f, value):
try:
return pack(f, value)
except error:
raise ValueError(error)
except error as e:
raise ValueError("Error encountered when attempting to convert value: "
"{} to struct format: '{}', hit error: {}"
Copy link
Collaborator

@tvoinarovskyi tvoinarovskyi Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe {!r} for value just in case str is overridden.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to do this earlier, changed in #1373

.format(value, f, e))


def _unpack(f, data):
try:
(value,) = unpack(f, data)
return value
except error:
raise ValueError(error)
except error as e:
raise ValueError("Error encountered when attempting to convert value: "
"{} to struct format: '{}', hit error: {}"
.format(value, f, e))


class Int8(AbstractType):
Expand Down