Logic for handling various handshakejs errors.