@@ -78,7 +78,7 @@ export class Decoder<ContextType> {
7878 private readonly maxMapLength = DEFAULT_MAX_LENGTH ,
7979 private readonly maxExtLength = DEFAULT_MAX_LENGTH ,
8080 private readonly keyDecoder : KeyDecoder | null = sharedCachedKeyDecoder ,
81- ) { }
81+ ) { }
8282
8383 private reinitializeState ( ) {
8484 this . totalPos = 0 ;
@@ -109,7 +109,7 @@ export class Decoder<ContextType> {
109109 return this . view . byteLength - this . pos >= size ;
110110 }
111111
112- private createNoExtraBytesError ( posToShow : number ) : Error {
112+ private createExtraByteError ( posToShow : number ) : Error {
113113 const { view, pos } = this ;
114114 return new RangeError ( `Extra ${ view . byteLength - pos } of ${ view . byteLength } byte(s) found at buffer[${ posToShow } ]` ) ;
115115 }
@@ -123,7 +123,7 @@ export class Decoder<ContextType> {
123123 private doDecodeSingleSync ( ) : unknown {
124124 const object = this . doDecodeSync ( ) ;
125125 if ( this . hasRemaining ( ) ) {
126- throw this . createNoExtraBytesError ( this . pos ) ;
126+ throw this . createExtraByteError ( this . pos ) ;
127127 }
128128 return object ;
129129 }
@@ -133,7 +133,7 @@ export class Decoder<ContextType> {
133133 let object : unknown ;
134134 for await ( const buffer of stream ) {
135135 if ( decoded ) {
136- throw this . createNoExtraBytesError ( this . totalPos ) ;
136+ throw this . createExtraByteError ( this . totalPos ) ;
137137 }
138138
139139 this . appendBuffer ( buffer ) ;
@@ -152,7 +152,7 @@ export class Decoder<ContextType> {
152152
153153 if ( decoded ) {
154154 if ( this . hasRemaining ( ) ) {
155- throw this . createNoExtraBytesError ( this . totalPos ) ;
155+ throw this . createExtraByteError ( this . totalPos ) ;
156156 }
157157 return object ;
158158 }
@@ -177,7 +177,7 @@ export class Decoder<ContextType> {
177177
178178 for await ( const buffer of stream ) {
179179 if ( isArray && arrayItemsLeft === 0 ) {
180- throw this . createNoExtraBytesError ( this . totalPos ) ;
180+ throw this . createExtraByteError ( this . totalPos ) ;
181181 }
182182
183183 this . appendBuffer ( buffer ) ;
0 commit comments