From b1246446c2ef8706241be47af73525ec75a48329 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 10 May 2022 15:20:00 -0400 Subject: [PATCH] Raise error on 'fatal' and 'error' log levels --- piker/data/_ahab.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/piker/data/_ahab.py b/piker/data/_ahab.py index e0f79be4..0f96ecaa 100644 --- a/piker/data/_ahab.py +++ b/piker/data/_ahab.py @@ -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