Skip to content

Commit

Permalink
NBTError Removal
Browse files Browse the repository at this point in the history
Removing this in favor of looking into a better solution later down the road.

This is breaking for Bedrock-LevelDB, but I also don't want to rely on how this is currently setup, I intend to start making the code for this much better, and in doing that I have to make breaking changes where it can lead to success later.

#31
  • Loading branch information
Offroaders123 committed Aug 25, 2024
1 parent 9bc4348 commit ebe570b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
20 changes: 0 additions & 20 deletions src/error.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ export * from "./stringify.js";
export * from "./format.js";
export * from "./tag.js";
export * from "./primitive.js";
export * from "./error.js";
export * from "./compression.js";
3 changes: 1 addition & 2 deletions src/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { NBTData } from "./format.js";
import { Int8, Int16, Int32, Float32 } from "./primitive.js";
import { TAG, TAG_TYPE, isTagType } from "./tag.js";
import { decompress } from "./compression.js";
import { NBTError } from "./error.js";

import type { RootName, Endian, Compression, BedrockLevel } from "./format.js";
import type { Tag, RootTag, RootTagLike, ByteTag, ShortTag, IntTag, LongTag, FloatTag, DoubleTag, StringTag, ByteArrayTag, ListTag, CompoundTag, IntArrayTag, LongArrayTag } from "./tag.js";
Expand Down Expand Up @@ -179,7 +178,7 @@ class NBTReader {

if (strict && this.#data.byteLength > this.#byteOffset) {
const remaining: number = this.#data.byteLength - this.#byteOffset;
throw new NBTError(`Encountered unexpected End tag at byte offset ${this.#byteOffset}, ${remaining} unread bytes remaining`, { byteOffset: this.#byteOffset, cause: new NBTData<RootTag>(root as RootTag, { rootName: rootNameV, endian }), remaining });
throw new Error(`Encountered unexpected End tag at byte offset ${this.#byteOffset}, ${remaining} unread bytes remaining`);
}

return new NBTData(root, { rootName: rootNameV, endian, compression, bedrockLevel });
Expand Down

0 comments on commit ebe570b

Please sign in to comment.