async def run(self): try: if self.initialized: # Start Server Logger.info(f"Starting Server {self.name} On {self.address} Port {self.port}", module="obsidian") await self.server.serve_forever() else: raise ServerError("Server Did Not Initialize. This May Be Because server.init() Was Never Called Or An Error Occurred While Initializing") except ServerError as e: Logger.fatal(f"Error While Starting Server - {type(e).__name__}: {e}", module="server", printTb=False) except Exception as e: Logger.fatal(f"Error While Starting Server - {type(e).__name__}: {e}", module="server")
async def init(self, *args, **kwargs): try: return await self._init(*args, **kwargs) except FatalError as e: # NOTE: e is already formatted with the type and stuff Logger.fatal("Fatal Error Detected. Stopping Server.", module="obsidian", printTb=False) Logger.fatal(f"{type(e).__name__}: {e}", module="main") except Exception as e: Logger.fatal("==================== FATAL ERROR! ====================", module="obsidian", printTb=False) Logger.fatal(f"Fatal Error While Initializing Server - {type(e).__name__}: {e}", module="obsidian", printTb=False) Logger.fatal("===================== Traceback ======================", module="obsidian", printTb=False) Logger.log(f"{traceback.format_exc()}") Logger.fatal("==================== FATAL ERROR! ====================", module="obsidian", printTb=False)