UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

90 lines (42 loc) 1.56 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [ErrorHandler](./server.errorhandler.md) ## ErrorHandler class Manages error and warning logging. When to use: reporting recoverable issues or fatal errors with consistent formatting. Do NOT use for: normal control flow; prefer explicit return values or exceptions. **Signature:** ```typescript export default class ErrorHandler ``` ## Remarks In production, `console.log` is disabled to reduce log spam; use `console.info` instead. Pattern: log warnings for recoverable issues and use `ErrorHandler.fatalError` for unrecoverable state. Anti-pattern: swallowing exceptions without logging context. \*\*Category:\*\* Utilities ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [error(message, context)](./server.errorhandler.error.md) </td><td> `static` </td><td> Logs a formatted error message with stack trace to help debug issues </td></tr> <tr><td> [fatalError(message, context)](./server.errorhandler.fatalerror.md) </td><td> `static` </td><td> Logs a formatted fatal error message with stack trace and throws the error </td></tr> <tr><td> [warning(message, context)](./server.errorhandler.warning.md) </td><td> `static` </td><td> Logs a formatted warning message to alert about potential issues </td></tr> </tbody></table>