diff --git a/amqpstorm/channel.py b/amqpstorm/channel.py index 9e0c7e3a..ed2ec52c 100644 --- a/amqpstorm/channel.py +++ b/amqpstorm/channel.py @@ -222,7 +222,7 @@ def check_for_errors(self,): self.check_for_exceptions() if self.is_closed: - raise AMQPChannelError('channel was closed') + raise AMQPChannelError('channel closed') def check_for_exceptions(self): """Check channel for exceptions. diff --git a/amqpstorm/connection.py b/amqpstorm/connection.py index 7ad2aca4..7ed6b540 100644 --- a/amqpstorm/connection.py +++ b/amqpstorm/connection.py @@ -181,7 +181,7 @@ def channel(self, rpc_timeout=60, lazy=False): if not compatibility.is_integer(rpc_timeout): raise AMQPInvalidArgument('rpc_timeout should be an integer') elif self.is_closed: - raise AMQPConnectionError('socket/connection closed') + raise AMQPConnectionError('connection closed') with self.lock: channel_id = self._get_next_available_channel_id() @@ -202,7 +202,7 @@ def check_for_errors(self): if not self.exceptions: if not self.is_closed: return - why = AMQPConnectionError('connection was closed') + why = AMQPConnectionError('connection closed') self.exceptions.append(why) self.set_state(self.CLOSED) self.close() @@ -402,5 +402,5 @@ def _wait_for_connection_state(self, state=Stateful.OPEN, rpc_timeout=30): while self.current_state != state: self.check_for_errors() if time.time() - start_time > rpc_timeout: - raise AMQPConnectionError('Connection timed out') + raise AMQPConnectionError('connection timed out') sleep(IDLE_WAIT) diff --git a/amqpstorm/tests/functional/management/test_connection.py b/amqpstorm/tests/functional/management/test_connection.py index b173671a..b5d472d0 100644 --- a/amqpstorm/tests/functional/management/test_connection.py +++ b/amqpstorm/tests/functional/management/test_connection.py @@ -76,6 +76,6 @@ def test_api_connection_close(self): self.assertTrue(connection_found) self.assertRaisesRegex( - AMQPConnectionError, 'socket/connection closed', + AMQPConnectionError, 'connection closed', connection.channel, 1 ) diff --git a/amqpstorm/tests/unit/channel/test_channel_exception.py b/amqpstorm/tests/unit/channel/test_channel_exception.py index 334d0ff1..d128bbee 100644 --- a/amqpstorm/tests/unit/channel/test_channel_exception.py +++ b/amqpstorm/tests/unit/channel/test_channel_exception.py @@ -57,7 +57,7 @@ def test_channel_check_error_when_closed(self): self.assertRaisesRegex( exception.AMQPChannelError, - 'channel was closed', + 'channel closed', channel.check_for_errors ) @@ -66,7 +66,7 @@ def test_channel_check_error_connection_closed(self): self.assertRaisesRegex( exception.AMQPConnectionError, - 'connection was closed', + 'connection closed', channel.check_for_errors ) @@ -77,7 +77,7 @@ def test_channel_raises_when_closed(self): self.assertFalse(channel.is_open) self.assertRaisesRegex( exception.AMQPChannelError, - 'channel was closed', + 'channel closed', channel.check_for_errors ) self.assertTrue(channel.is_closed) @@ -89,7 +89,7 @@ def test_channel_closed_after_connection_closed(self): self.assertTrue(channel.is_open) self.assertRaisesRegex( exception.AMQPConnectionError, - 'connection was closed', + 'connection closed', channel.check_for_errors ) self.assertTrue(channel.is_closed)