From a3709926e46a5f68b8fd21f2a36f4f0f8386d42e Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Thu, 29 Jul 2021 12:32:12 +0200 Subject: [PATCH] Log when there are no results for symbol search. --- src/pricehist/sources/basesource.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pricehist/sources/basesource.py b/src/pricehist/sources/basesource.py index 52f0df8..61d5318 100644 --- a/src/pricehist/sources/basesource.py +++ b/src/pricehist/sources/basesource.py @@ -65,6 +65,9 @@ class BaseSource(ABC): if (symbols := self.search(query)) is None: logging.error(f"Symbol search is not possible for the {self.id()} source.") exit(1) + elif symbols == []: + logging.info(f"No results found for query '{query}'.") + return "" else: width = max([len(sym) for sym, desc in symbols] + [0]) lines = [sym.ljust(width + 4) + desc + "\n" for sym, desc in symbols]