Error reference
Every error JSPrismarine throws has a code and an entry in this reference. When the server logs an error, the last line names its code and links to the entry:
More about PRISMARINE_PLAYER_NOT_FOUND: https://jsprismarine.dev/errors/prismarine/server#prismarine-player-not-foundCode that embeds the server or uses a package on its own reads the same two values from the error it catches, as error.code and error.docs.
There are 1416 errors, one page per package. A package that throws many, such as @jsprismarine/prismarine, has a page per catalog module as well, which its page lists:
Reading an entry
An entry's heading is the error's code, such as PRISMARINE_PLAYER_NOT_FOUND. Below it is the message, with each value the error fills in written as a name in braces: the message Player "{username}" not found. reaches the log as Player "Steve" not found..
Next comes the class to catch the error by. Most errors extend Error, TypeError or RangeError, as the code threw before the reference existed. Some extend a group class instead, such as CorruptionError in @jsprismarine/leveldb, so one instanceof check catches every error of that kind. A package's page lists its groups first. When the code explains what causes an error and what to do about it, that explanation follows.
Adding an error
The errors live in @jsprismarine/errors, one catalog per package, and code throws them from there. Its README explains how to add one, and the lint fails on a new Error(...) anywhere else.