This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 678
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add errorHelper, cleanup error handling when blocks are out of range
- Loading branch information
1 parent
308a6d6
commit c02be96
Showing
4 changed files
with
30 additions
and
7 deletions.
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
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
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 @@ | ||
class LevelUpOutOfRangeError extends Error { | ||
constructor(type, index, len) { | ||
const message = "LevelUpArrayAdapter named '" + type + "' index out of range: index " + index + "; length: " + len; | ||
super(message); | ||
this.message = message; | ||
this.name = `${this.constructor.name}:${type}`; | ||
this.type = type; | ||
} | ||
} | ||
|
||
class BlockOutOfRangeError extends LevelUpOutOfRangeError { | ||
constructor(index, len) { | ||
super("blocks", index, len); | ||
} | ||
} | ||
|
||
module.exports = { | ||
LevelUpOutOfRangeError, | ||
BlockOutOfRangeError | ||
}; |