1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

more error handling for entity encoding

This commit is contained in:
Robin Appelman 2017-09-15 23:10:35 +02:00
commit f0c7460007

View file

@ -33,6 +33,10 @@ export function encodeEntityUpdate(props: SendProp[], sendTable: SendTable, stre
if (index === -1) { if (index === -1) {
throw new Error(`Unknown definition for property ${prop.definition.fullName} in ${sendTable.name}`); throw new Error(`Unknown definition for property ${prop.definition.fullName} in ${sendTable.name}`);
} }
if (index < lastIndex) {
throw new Error(`Property index not incremental while encoding ${prop.definition.fullName} in ${sendTable.name} (current: ${index}, last: ${lastIndex})`);
}
writeFieldIndex(index, stream, lastIndex); writeFieldIndex(index, stream, lastIndex);
lastIndex = index; lastIndex = index;