Raise error on 'fatal' and 'error' log levels

l1_precision_fix
Tyler Goodlet 2022-05-10 15:20:00 -04:00
parent 083a3296e7
commit b1246446c2
1 changed files with 12 additions and 1 deletions

View File

@ -33,7 +33,10 @@ from tractor.msg import NamespacePath
import docker
import json
from docker.models.containers import Container as DockerContainer
from docker.errors import DockerException, APIError
from docker.errors import (
DockerException,
APIError,
)
from requests.exceptions import ConnectionError, ReadTimeout
from ..log import get_logger, get_console_log
@ -46,6 +49,10 @@ class DockerNotStarted(Exception):
'Prolly you dint start da daemon bruh'
class ContainerError(RuntimeError):
'Error reported via app-container logging level'
@acm
async def open_docker(
url: Optional[str] = None,
@ -148,6 +155,10 @@ class Container:
getattr(log, level, log.error)(f'{msg}')
# print(f'level: {level}')
if level in ('error', 'fatal'):
raise ContainerError(msg)
if patt in msg:
return True