Skip to content

Commit fbfb5f0

Browse files
committed
use more descriptive exception message
1 parent 2674bb1 commit fbfb5f0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/hyperframe/frame.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,19 @@ def __init__(self, stream_id, flags=()):
6868

6969
if (not self.stream_id and
7070
self.stream_association == _STREAM_ASSOC_HAS_STREAM):
71-
raise InvalidDataError('Stream ID must be non-zero')
71+
raise InvalidDataError(
72+
'Stream ID must be non-zero for {}'.format(
73+
type(self).__name__,
74+
)
75+
)
7276
if (self.stream_id and
7377
self.stream_association == _STREAM_ASSOC_NO_STREAM):
74-
raise InvalidDataError('Stream ID must be zero')
78+
raise InvalidDataError(
79+
'Stream ID must be zero for {} with stream_id: {}'.format(
80+
type(self).__name__,
81+
self.stream_id,
82+
)
83+
)
7584

7685
def __repr__(self):
7786
flags = ", ".join(self.flags) or "None"

0 commit comments

Comments
 (0)