diff --git a/CHANGES/4068.bugfix b/CHANGES/4068.bugfix new file mode 100644 index 00000000000..54c82a16e7b --- /dev/null +++ b/CHANGES/4068.bugfix @@ -0,0 +1 @@ +correct some exception string format diff --git a/aiohttp/http_websocket.py b/aiohttp/http_websocket.py index 2cfe3a12851..5c9491816d6 100644 --- a/aiohttp/http_websocket.py +++ b/aiohttp/http_websocket.py @@ -356,9 +356,12 @@ def _feed_data(self, data: bytes) -> Tuple[bool, bytes]: left = len(self._decompressobj.unconsumed_tail) raise WebSocketError( WSCloseCode.MESSAGE_TOO_BIG, - "Decompressed message size exceeds limit {}". - format(self._max_msg_size + left, - self._max_msg_size)) + "Decompressed message size {} exceeds limit {}" + .format( + self._max_msg_size + left, + self._max_msg_size + ) + ) else: payload_merged = bytes(self._partial) diff --git a/aiohttp/payload.py b/aiohttp/payload.py index 5b110ba1dd1..7e633028d42 100644 --- a/aiohttp/payload.py +++ b/aiohttp/payload.py @@ -207,7 +207,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: if not isinstance(value, (bytes, bytearray, memoryview)): - raise TypeError("value argument must be byte-ish, not (!r)" + raise TypeError("value argument must be byte-ish, not {!r}" .format(type(value))) if 'content_type' not in kwargs: