mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-22 16:46:29 +00:00
Use new format for logging exceptions - docker/init.py (#3189)
This commit is contained in:
parent
6c679b07e1
commit
ad2566d58a
@ -149,14 +149,17 @@ class DockerAPI:
|
|||||||
f"{image}:{tag}", use_config_proxy=False, **kwargs
|
f"{image}:{tag}", use_config_proxy=False, **kwargs
|
||||||
)
|
)
|
||||||
except docker.errors.NotFound as err:
|
except docker.errors.NotFound as err:
|
||||||
_LOGGER.error("Image %s not exists for %s", image, name)
|
raise DockerNotFound(
|
||||||
raise DockerNotFound() from err
|
f"Image {image} not exists for {name}", _LOGGER.error
|
||||||
|
) from err
|
||||||
except docker.errors.DockerException as err:
|
except docker.errors.DockerException as err:
|
||||||
_LOGGER.error("Can't create container from %s: %s", name, err)
|
raise DockerAPIError(
|
||||||
raise DockerAPIError() from err
|
f"Can't create container from {name}: {err}", _LOGGER.error
|
||||||
|
) from err
|
||||||
except requests.RequestException as err:
|
except requests.RequestException as err:
|
||||||
_LOGGER.error("Dockerd connection issue for %s: %s", name, err)
|
raise DockerRequestError(
|
||||||
raise DockerRequestError() from err
|
f"Dockerd connection issue for {name}: {err}", _LOGGER.error
|
||||||
|
) from err
|
||||||
|
|
||||||
# Attach network
|
# Attach network
|
||||||
if not network_mode:
|
if not network_mode:
|
||||||
@ -186,11 +189,11 @@ class DockerAPI:
|
|||||||
try:
|
try:
|
||||||
container.start()
|
container.start()
|
||||||
except docker.errors.DockerException as err:
|
except docker.errors.DockerException as err:
|
||||||
_LOGGER.error("Can't start %s: %s", name, err)
|
raise DockerAPIError(f"Can't start {name}: {err}", _LOGGER.error) from err
|
||||||
raise DockerAPIError() from err
|
|
||||||
except requests.RequestException as err:
|
except requests.RequestException as err:
|
||||||
_LOGGER.error("Dockerd connection issue for %s: %s", name, err)
|
raise DockerRequestError(
|
||||||
raise DockerRequestError() from err
|
f"Dockerd connection issue for {name}: {err}", _LOGGER.error
|
||||||
|
) from err
|
||||||
|
|
||||||
# Update metadata
|
# Update metadata
|
||||||
with suppress(docker.errors.DockerException, requests.RequestException):
|
with suppress(docker.errors.DockerException, requests.RequestException):
|
||||||
@ -228,8 +231,7 @@ class DockerAPI:
|
|||||||
output = container.logs(stdout=stdout, stderr=stderr)
|
output = container.logs(stdout=stdout, stderr=stderr)
|
||||||
|
|
||||||
except (docker.errors.DockerException, requests.RequestException) as err:
|
except (docker.errors.DockerException, requests.RequestException) as err:
|
||||||
_LOGGER.error("Can't execute command: %s", err)
|
raise DockerError(f"Can't execute command: {err}", _LOGGER.error) from err
|
||||||
raise DockerError() from err
|
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# cleanup container
|
# cleanup container
|
||||||
|
Loading…
x
Reference in New Issue
Block a user