File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,25 +59,25 @@ class JsonParser<T> {
5959 return str ;
6060 }
6161
62- async #nextNonEof( len ?: number ) : Promise < string > {
62+ async #nextNonEof( len ?: number , message ?: string ) : Promise < string > {
6363 const chunk = await this . #next( len ) ;
64- assert ( chunk !== undefined , ' Unexpected end of JSON input.' ) ;
64+ assert ( chunk !== undefined , ` Unexpected end of JSON input: ${ message } ` ) ;
6565 return chunk ! ;
6666 }
6767
6868 async #skipWhiteSpaces( ) : Promise < string > {
6969 for (
70- let char = await this . #nextNonEof( ) ;
70+ let char = await this . #nextNonEof( 1 , 'skipWhiteSpaces' ) ;
7171 ;
72- char = await this . #nextNonEof( )
72+ char = await this . #nextNonEof( 1 , 'skipWhiteSpaces' )
7373 ) {
7474 if ( ! this . #isWhitespace( char ) ) return char ;
7575 }
7676 }
7777
7878 async #expectNext( expected : string ) : Promise < string > {
79- const char = await this . #nextNonEof( expected . length ) ;
80- assertEq ( char , expected , `Expected '${ expected } ' got '${ char } '` ) ;
79+ const char = await this . #nextNonEof( expected . length , `Expected ' ${ expected } ', got EOF.` ) ;
80+ assertEq ( char , expected , `Expected '${ expected } ' got '${ char } '` ) ;
8181 return char ;
8282 }
8383
You can’t perform that action at this time.
0 commit comments