Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ts/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class Builder {
*/
nested(obj: Offset): void {
if (obj != this.offset()) {
throw new Error('FlatBuffers: struct must be serialized inline.');
throw new TypeError('FlatBuffers: struct must be serialized inline.');
}
}

Expand All @@ -278,7 +278,7 @@ export class Builder {
*/
notNested(): void {
if (this.isNested) {
throw new Error('FlatBuffers: object serialization must not be nested.');
throw new TypeError('FlatBuffers: object serialization must not be nested.');
}
}

Expand Down Expand Up @@ -429,7 +429,7 @@ export class Builder {
this.prep(this.minalign, SIZEOF_INT +
FILE_IDENTIFIER_LENGTH + size_prefix);
if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {
throw new Error('FlatBuffers: file identifier must be length ' +
throw new TypeError('FlatBuffers: file identifier must be length ' +
FILE_IDENTIFIER_LENGTH);
}
for (let i = FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {
Expand Down Expand Up @@ -463,7 +463,7 @@ export class Builder {

// If this fails, the caller will show what field needs to be set.
if (!ok) {
throw new Error('FlatBuffers: field ' + field + ' must be set');
throw new TypeError('FlatBuffers: field ' + field + ' must be set');
}
}

Expand Down Expand Up @@ -576,7 +576,7 @@ export class Builder {
if(val !== null) {
ret.push(this.createObjectOffset(val));
} else {
throw new Error(
throw new TypeError(
'FlatBuffers: Argument for createObjectOffsetList cannot contain null.');
}
}
Expand Down