fix: handle errors in validateconnection

This commit is contained in:
Adhiraj Singh
2022-10-16 15:25:10 +05:30
parent a85698b201
commit 3977444bc5

View File

@@ -425,7 +425,14 @@ export const makeSocket = ({
}
ws.on('message', onMessageRecieved)
ws.on('open', validateConnection)
ws.on('open', async() => {
try {
await validateConnection()
} catch(err) {
logger.error({ err }, 'error in validating connection')
end(err)
}
})
ws.on('error', error => end(
new Boom(
`WebSocket Error (${error.message})`,