parent
49bdfbd9ca
commit
3fba02a692
|
@ -89,7 +89,7 @@ class MinecraftServer:
|
|||
self._server.timeout = DATA_UPDATE_TIMEOUT
|
||||
|
||||
_LOGGER.debug(
|
||||
"%s server instance created with address '%s'",
|
||||
"Initialized %s server instance with address '%s'",
|
||||
self._server_type,
|
||||
self._address,
|
||||
)
|
||||
|
@ -98,7 +98,15 @@ class MinecraftServer:
|
|||
"""Check if the server is online, supporting both Java and Bedrock Edition servers."""
|
||||
try:
|
||||
await self.async_get_data()
|
||||
except (MinecraftServerConnectionError, MinecraftServerNotInitializedError):
|
||||
except (
|
||||
MinecraftServerConnectionError,
|
||||
MinecraftServerNotInitializedError,
|
||||
) as error:
|
||||
_LOGGER.debug(
|
||||
"Connection check of %s server failed: %s",
|
||||
self._server_type,
|
||||
self._get_error_message(error),
|
||||
)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
@ -108,7 +116,9 @@ class MinecraftServer:
|
|||
status_response: BedrockStatusResponse | JavaStatusResponse
|
||||
|
||||
if self._server is None:
|
||||
raise MinecraftServerNotInitializedError()
|
||||
raise MinecraftServerNotInitializedError(
|
||||
f"Server instance with address '{self._address}' is not initialized"
|
||||
)
|
||||
|
||||
try:
|
||||
status_response = await self._server.async_status(tries=DATA_UPDATE_RETRIES)
|
||||
|
|
|
@ -44,17 +44,17 @@ class MinecraftServerConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
try:
|
||||
await api.async_initialize()
|
||||
except MinecraftServerAddressError:
|
||||
pass
|
||||
except MinecraftServerAddressError as error:
|
||||
_LOGGER.debug(
|
||||
"Initialization of %s server failed: %s",
|
||||
server_type,
|
||||
error,
|
||||
)
|
||||
else:
|
||||
if await api.async_is_online():
|
||||
config_data[CONF_TYPE] = server_type
|
||||
return self.async_create_entry(title=address, data=config_data)
|
||||
|
||||
_LOGGER.debug(
|
||||
"Connection check to %s server '%s' failed", server_type, address
|
||||
)
|
||||
|
||||
# Host or port invalid or server not reachable.
|
||||
errors["base"] = "cannot_connect"
|
||||
|
||||
|
|
Loading…
Reference in New Issue