Improved error handling to separate errors from client disconnect.