HungerLib defines three distinct exception families: theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/HungerLib/llms.txt
Use this file to discover all available pages before exploring further.
ValidationError hierarchy for configuration schema problems, HungerLibError subtypes for runtime library errors, and HungerBridgeError for failures returned by the HungerBridge sidecar. Each family has its own base class so you can catch broadly or precisely depending on your needs.
Validation Exceptions
These exceptions are raised by theValidator class when a configuration schema is checked via Validator.run(). They form a hierarchy rooted at ValidationError so you can choose how broadly to catch them.
All ValidationError instances carry structured data about what went wrong, not just a message string. This lets automation scripts inspect individual errors programmatically rather than parsing a string report.
ValidationError
The base class for all configuration validation failures. Subclasses indicate the severity and nature of the issue.
A human-readable multi-line report generated by
Validator.format_report(). Contains sections for errors, recommended, fallbacks, and warnings as applicable. Printed automatically when the exception is not caught.A list of error message strings describing required fields that are missing or invalid. Empty if no errors were found.
A list of warning message strings. Currently reserved for future use by custom
Validator subclasses.A list of messages describing fields that are present in YAML but whose value matches the fallback default. Raised as
FallbackError when non-empty.A list of messages for keys that are absent from the YAML and are considered recommended (not strictly required). Raised as
RecommendedError when non-empty.FatalError
Raised when one or more required configuration fields are missing from the YAML file, or when a required field is set to its fallback value (which is disallowed for "required" fields). Inherits from ValidationError.
This is the highest-priority validation exception. Validator.run() raises FatalError as soon as any entry appears in self.errors, before checking for lower-severity issues.
TypeMismatchError
Raised when a YAML value’s Python type does not match the type annotation declared on the corresponding dataclass field. Inherits from ValidationError.
In practice, Validator.run() currently raises FatalError before reaching type mismatch checking if self.errors is non-empty. TypeMismatchError is raised independently when type errors are detected without other fatal errors present.
FallbackError
Raised when a recommended field is present in the YAML file but its value equals the fallback default. This signals that the user has not customised the field. Inherits from ValidationError.
RecommendedError
Raised when a key marked as "recommended" in the Validator.rules schema is absent from the YAML file entirely. The field will be populated with its fallback value, but the user is notified that they should set it explicitly. Inherits from ValidationError.
Library Exceptions
These exceptions are raised by HungerLib internals at runtime — not during configuration validation, but during normal operation such as logging or querying server state.HungerLibError
The base class for all HungerLib runtime errors. Catch this to handle any library-originated exception without specifying a subtype.
InvalidLevelError
Raised when an unrecognised log level is passed to MessageRouter or to BridgeClient.log(). Valid log levels are defined by MessageRouter’s configured level set. Inherits from HungerLibError.
InvalidModeError
Raised when an unrecognised mode string is passed to a method that accepts a mode parameter, such as MinecraftServer.getTPS() or MinecraftServer.getPlayers(). Valid modes are documented on the individual method. Inherits from HungerLibError.
Bridge Exceptions
HungerBridgeError
Raised by BridgeClient when the HungerBridge sidecar returns a non-2xx HTTP response. This indicates a problem on the HungerBridge side — for example, an invalid endpoint, a missing server registration, or a bridge-side runtime error. It does not inherit from HungerLibError; it is a standalone exception rooted at Exception.
HungerBridgeError around any BridgeClient call to handle bridge communication failures gracefully: