Connection error display

This commit is contained in:
Evert Prants 2020-02-08 12:50:56 +02:00
parent 25e83a7c30
commit 2d1b534d16
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 9 additions and 3 deletions

View File

@ -281,8 +281,8 @@ class IRCConnectionHandler {
let list = null
switch (line.command) {
case 'error':
this.conn.emit('connectionError', new Error('IRCError' + line.raw))
case 'ERROR':
this.conn.emit('connectionError', new Error('IRCError ' + line.message))
break
case 'PONG':
this.conn.ping = Date.now() - this.conn.pingSent

View File

@ -1313,6 +1313,10 @@ class ConnectionHandler {
irc.chat.newServerChatBuffer(client)
irc.chat.joinChannels(client.data.actualServer, data.channels)
})
client.once('connectionError', (e) => {
if (e.message.indexOf('IRCError') !== 0) return
irc.auther.authMessage(e.message, true)
})
client.connect().catch(e => {
console.error(e)
irc.auther.authMessage('Socket connection failed!', true)
@ -1457,6 +1461,7 @@ class IRCConnector {
}
fillFormFromURI (urlParams) {
let skipServer = false
if (this.defaults.server) {
clientdom.connector.server.value = this.defaults.server
}
@ -1494,6 +1499,7 @@ class IRCConnector {
case 'server':
case 'host':
if (validators.iporhost(value)) {
skipServer = true
clientdom.connector.server.value = value
}
break
@ -1518,7 +1524,7 @@ class IRCConnector {
clientdom.connector.channel.value = window.location.hash
}
if (window.location.pathname.length > 4) {
if (window.location.pathname.length > 4 && !skipServer) {
let t1 = window.location.pathname.substring(1, window.location.pathname.length - 1)
let proposed = ''