-
Notifications
You must be signed in to change notification settings - Fork 4
/
failure-packet.ts
48 lines (43 loc) · 1.1 KB
/
failure-packet.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Writer } from '../../writer';
import { Reader } from '../../reader';
import { PacketType } from '../../packet-type';
import { Packet } from '../../packet';
import { FailureCode } from '../../models/failure-code';
/**
* Received when an error has occurred.
*/
export class FailurePacket implements Packet {
type = PacketType.FAILURE;
propagate = true;
//#region packet-specific members
/**
* The error id of the failure.
* @see `FailureCode`
*/
errorId: FailureCode;
/**
* A description of the error.
*/
errorDescription: string;
/**
* > Unknown.
*/
errorPlace: string;
/**
* > Unknown.
*/
errorConnectionId: string;
//#endregion
read(reader: Reader): void {
this.errorId = reader.readInt32();
this.errorDescription = reader.readString();
this.errorPlace = reader.readString();
this.errorConnectionId = reader.readString();
}
write(writer: Writer): void {
writer.writeInt32(this.errorId);
writer.writeString(this.errorDescription);
writer.writeString(this.errorPlace);
writer.writeString(this.errorConnectionId);
}
}