Skip to content

Commit

Permalink
[fix] add ChannelInvalidStateError exceptions instead of RuntimeError
Browse files Browse the repository at this point in the history
  • Loading branch information
mosquito committed Nov 13, 2019
1 parent 5e735e0 commit 26ffef5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions aiormq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
AuthenticationError,
ChannelAccessRefused,
ChannelClosed,
ChannelInvalidStateError,
ChannelLockedResource,
ChannelNotFoundEntity,
ChannelPreconditionFailed,
Expand Down Expand Up @@ -52,6 +53,7 @@
'Channel',
'ChannelAccessRefused',
'ChannelClosed',
'ChannelInvalidStateError',
'ChannelLockedResource',
'ChannelNotFoundEntity',
'ChannelPreconditionFailed',
Expand Down
2 changes: 1 addition & 1 deletion aiormq/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, connector, number,
@property
def lock(self):
if self.is_closed:
raise RuntimeError('%r closed' % self)
raise exc.ChannelInvalidStateError('%r closed' % self)

return self.__lock

Expand Down
4 changes: 4 additions & 0 deletions aiormq/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,7 @@ def __init__(self, message: DeliveredMessage, frame: spec.Frame, *args):
message.delivery.routing_key,
*args
)


class ChannelInvalidStateError(RuntimeError):
pass
2 changes: 1 addition & 1 deletion aiormq/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

team_email = '[email protected]'

version_info = (3, 0, 1)
version_info = (3, 1, 0)

__author__ = ", ".join("{} <{}>".format(*info) for info in author_info)
__version__ = ".".join(map(str, version_info))

0 comments on commit 26ffef5

Please sign in to comment.