Raise error on 'fatal' and 'error' log levels
parent
083a3296e7
commit
b1246446c2
|
@ -33,7 +33,10 @@ from tractor.msg import NamespacePath
|
||||||
import docker
|
import docker
|
||||||
import json
|
import json
|
||||||
from docker.models.containers import Container as DockerContainer
|
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 requests.exceptions import ConnectionError, ReadTimeout
|
||||||
|
|
||||||
from ..log import get_logger, get_console_log
|
from ..log import get_logger, get_console_log
|
||||||
|
@ -46,6 +49,10 @@ class DockerNotStarted(Exception):
|
||||||
'Prolly you dint start da daemon bruh'
|
'Prolly you dint start da daemon bruh'
|
||||||
|
|
||||||
|
|
||||||
|
class ContainerError(RuntimeError):
|
||||||
|
'Error reported via app-container logging level'
|
||||||
|
|
||||||
|
|
||||||
@acm
|
@acm
|
||||||
async def open_docker(
|
async def open_docker(
|
||||||
url: Optional[str] = None,
|
url: Optional[str] = None,
|
||||||
|
@ -148,6 +155,10 @@ class Container:
|
||||||
|
|
||||||
getattr(log, level, log.error)(f'{msg}')
|
getattr(log, level, log.error)(f'{msg}')
|
||||||
|
|
||||||
|
# print(f'level: {level}')
|
||||||
|
if level in ('error', 'fatal'):
|
||||||
|
raise ContainerError(msg)
|
||||||
|
|
||||||
if patt in msg:
|
if patt in msg:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue