Some advice for handling closed connections

/cc #1093
This commit is contained in:
Zachary Scott 2016-05-10 20:39:49 +09:00
parent 6f0399f173
commit a9dc7ef1a7
1 changed files with 4 additions and 0 deletions

View File

@ -1597,6 +1597,10 @@ post '/:message' do
end
```
It's also possible for the client to close the connection when trying to write
to the socket. Because of this, it's recommended to check `out.closed?` before
trying to write.
### Logging
In the request scope, the `logger` helper exposes a `Logger` instance: