It probably fires as an async error, I'd expect this would log it (if inserted at the end of the try block):
socket.onerror = (...args) => console.log('async error', ...args) socket.onerror = (...args) => console.log('async error', ...args)