@@ -268,7 +268,7 @@ export class Builder {
268268 */
269269 nested ( obj : Offset ) : void {
270270 if ( obj != this . offset ( ) ) {
271- throw new Error ( 'FlatBuffers: struct must be serialized inline.' ) ;
271+ throw new TypeError ( 'FlatBuffers: struct must be serialized inline.' ) ;
272272 }
273273 }
274274
@@ -278,7 +278,7 @@ export class Builder {
278278 */
279279 notNested ( ) : void {
280280 if ( this . isNested ) {
281- throw new Error ( 'FlatBuffers: object serialization must not be nested.' ) ;
281+ throw new TypeError ( 'FlatBuffers: object serialization must not be nested.' ) ;
282282 }
283283 }
284284
@@ -429,7 +429,7 @@ export class Builder {
429429 this . prep ( this . minalign , SIZEOF_INT +
430430 FILE_IDENTIFIER_LENGTH + size_prefix ) ;
431431 if ( file_identifier . length != FILE_IDENTIFIER_LENGTH ) {
432- throw new Error ( 'FlatBuffers: file identifier must be length ' +
432+ throw new TypeError ( 'FlatBuffers: file identifier must be length ' +
433433 FILE_IDENTIFIER_LENGTH ) ;
434434 }
435435 for ( let i = FILE_IDENTIFIER_LENGTH - 1 ; i >= 0 ; i -- ) {
@@ -463,7 +463,7 @@ export class Builder {
463463
464464 // If this fails, the caller will show what field needs to be set.
465465 if ( ! ok ) {
466- throw new Error ( 'FlatBuffers: field ' + field + ' must be set' ) ;
466+ throw new TypeError ( 'FlatBuffers: field ' + field + ' must be set' ) ;
467467 }
468468 }
469469
@@ -576,7 +576,7 @@ export class Builder {
576576 if ( val !== null ) {
577577 ret . push ( this . createObjectOffset ( val ) ) ;
578578 } else {
579- throw new Error (
579+ throw new TypeError (
580580 'FlatBuffers: Argument for createObjectOffsetList cannot contain null.' ) ;
581581 }
582582 }
0 commit comments