Error message handler

This commit is contained in:
Emily 2019-07-31 17:10:07 +02:00
parent 9680949503
commit 2463cc3dbc

View File

@ -92,6 +92,18 @@ class FLYSocket {
// s: DataStream // s: DataStream
} }
handle_packet255(data) {
// Hxs
// H: Length
// s: ErrorMessage
let ret = "";
let length = data.getUint16(this.pointer); this.pointer += 2;
for (let i = 0; i < length; i++) {
ret += String.fromCharCode( data.getUint8(this.pointer++) );
}
return ret;
}
handle_packetInvalid(data) { handle_packetInvalid(data) {
throw TypeError(`Invalid DATA: ${Array.from( this.buffer2HexArray(data, --this.pointer) ).join(" ")}`); throw TypeError(`Invalid DATA: ${Array.from( this.buffer2HexArray(data, --this.pointer) ).join(" ")}`);
} }