Skip to content

Commit

Permalink
Fixes char error message: avoid to always display that the current st…
Browse files Browse the repository at this point in the history
…ate was "STOP"
  • Loading branch information
Tpt committed Oct 31, 2022
1 parent eabee77 commit 9085b68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/JsonEventParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export class JsonEventParser extends Transform {
}

private charError(buffer: Buffer, i: number): void {
const state = JsonEventParser.tokenName(this.tState);
this.tState = STOP;
throw new Error(`Unexpected ${JSON.stringify(String.fromCharCode(buffer[i]))} at position ${i} in state ${JsonEventParser.tokenName(this.tState)}`);
throw new Error(`Unexpected ${JSON.stringify(String.fromCharCode(buffer[i]))} at position ${i} in state ${state}`);
}

private appendStringChar(char: number): void {
Expand Down

0 comments on commit 9085b68

Please sign in to comment.