Skip to content

Commit 29baa21

Browse files
authored
Merge pull request #76 from njsmith/broken-resource-error
Small fixes to the example server
2 parents 87442eb + 14f6185 commit 29baa21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/trio-server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async def shutdown_and_clean_up(self):
149149
#
150150
try:
151151
await self.stream.send_eof()
152-
except trio.BrokenStreamError:
152+
except trio.BrokenResourceError:
153153
# They're already gone, nothing to do
154154
return
155155
# Wait and read for a bit to give them a chance to see that we closed
@@ -168,7 +168,7 @@ async def shutdown_and_clean_up(self):
168168
got = await self.stream.receive_some(MAX_RECV)
169169
if not got:
170170
break
171-
except trio.BrokenStreamError:
171+
except trio.BrokenResourceError:
172172
pass
173173
finally:
174174
await self.stream.aclose()
@@ -229,7 +229,7 @@ async def http_serve(stream):
229229
if type(event) is h11.Request:
230230
await send_echo_response(wrapper, event)
231231
except Exception as exc:
232-
wrapper.info("Error during response handler:", exc)
232+
wrapper.info("Error during response handler: {!r}".format(exc))
233233
await maybe_send_error_response(wrapper, exc)
234234

235235
if wrapper.conn.our_state is h11.MUST_CLOSE:

0 commit comments

Comments
 (0)