-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on figuring out the concepts behind making your own error handlers, in that I can provide the missing metadata I need to be able to get without needing to parse the error message itself. This is a big of a weird setup at the moment, since I don't quite know the correct way to structure these kinds of extensions. https://developer.mozilla.org/en-US/docs/Web/API/DOMException https://stackoverflow.com/questions/5136727/manually-artificially-throwing-a-domexception-with-javascript https://javascript.info/custom-errors https://stackoverflow.com/questions/67558074/how-to-throw-custom-errors https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause #31
- Loading branch information
1 parent
2bbeb2d
commit 388ac02
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { NBTData } from "./format.js"; | ||
|
||
export interface NBTErrorOptions extends ErrorOptions { | ||
byteOffset: number; | ||
cause: NBTData; | ||
remaining: number; | ||
} | ||
|
||
export class NBTError extends Error { | ||
byteOffset: number; | ||
override cause: NBTData; | ||
remaining: number; | ||
|
||
constructor(message: string, options: NBTErrorOptions) { | ||
super(message,options); | ||
this.byteOffset = options.byteOffset; | ||
this.cause = options.cause; | ||
this.remaining = options.remaining; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters