Raise error on 'fatal' and 'error' log levels
parent
083a3296e7
commit
b1246446c2
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue