Better handle registration errors
This commit is contained in:
@@ -93,10 +93,6 @@ export default class Client extends EventTarget {
|
||||
console.log("Registration complete");
|
||||
this.registered = true;
|
||||
break;
|
||||
case irc.ERR_PASSWDMISMATCH:
|
||||
this.dispatchEvent(new CustomEvent("error", { detail: "Password mismatch" }));
|
||||
this.close();
|
||||
break;
|
||||
case "CAP":
|
||||
this.handleCap(msg);
|
||||
break;
|
||||
@@ -148,6 +144,22 @@ export default class Client extends EventTarget {
|
||||
deleteBatch = name;
|
||||
}
|
||||
break;
|
||||
case "ERROR":
|
||||
this.dispatchEvent(new CustomEvent("error", { detail: "Fatal IRC error: " + msg.params[0] }));
|
||||
this.close();
|
||||
break;
|
||||
case irc.ERR_PASSWDMISMATCH:
|
||||
case irc.ERR_ERRONEUSNICKNAME:
|
||||
case irc.ERR_NICKNAMEINUSE:
|
||||
case irc.ERR_NICKCOLLISION:
|
||||
case irc.ERR_UNAVAILRESOURCE:
|
||||
case irc.ERR_NOPERMFORHOST:
|
||||
case irc.ERR_YOUREBANNEDCREEP:
|
||||
this.dispatchEvent(new CustomEvent("error", { detail: "Error (" + msg.command + "): " + msg.params[msg.params.length - 1] }));
|
||||
if (!this.registered) {
|
||||
this.close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this.dispatchEvent(new CustomEvent("message", {
|
||||
|
||||
Reference in New Issue
Block a user