Adding an explicit check for an error on a disconnect.

A WebSocket can be close normally in which case there will be no error.
The problem was that I was logging the error regardless which would
fail at run time for a normal close/disconnect.