feat: add error handle

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-03-02 22:28:27 +08:00
parent d7061c0c9d
commit 5132019ce6

View File

@ -21,6 +21,10 @@ function createConnection(host: string, port: number, username: string) {
return client; return client;
} }
client.on('error', (error) => {
console.log("Client Error", error)
})
client.on('end', (resone) => { client.on('end', (resone) => {
console.log("Client End Resone:", resone) console.log("Client End Resone:", resone)
client = createConnection('192.168.2.5', 25577, username) client = createConnection('192.168.2.5', 25577, username)
@ -48,6 +52,8 @@ rl.on('line', function (line) {
switch (line) { switch (line) {
case "": case "":
break; break;
case "eval":
break;
case "write": case "write":
break; break;
case "/respawn": case "/respawn":