summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-09-07 15:39:26 +0200
committerGitHub <noreply@github.com>2020-09-07 15:39:26 +0200
commit339738275446dc185e761bdc3f4714cf29d33fd8 (patch)
tree5b57c3cb86726d716a416aa128542402355e8be2 /searx
parentf77ad22d65df391098cde18196fdf1054419be1d (diff)
downloadsearxng-339738275446dc185e761bdc3f4714cf29d33fd8.tar.gz
searxng-339738275446dc185e761bdc3f4714cf29d33fd8.zip
[enh] stop searx when an engine raise an SyntaxError exception (#2177)
and some other exceptions: * KeyboardInterrupt * SystemExit * RuntimeError * SystemError * ImportError: an engine with an unmet dependency will stop everything.
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index 48c02e2e7..9fcf812b0 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -74,6 +74,9 @@ def load_engine(engine_data):
try:
engine = load_module(engine_module + '.py', engine_dir)
+ except (SyntaxError, KeyboardInterrupt, SystemExit, SystemError, ImportError, RuntimeError) as e:
+ logger.exception('Fatal exception in engine "{}"'.format(engine_module))
+ sys.exit(1)
except:
logger.exception('Cannot load engine "{}"'.format(engine_module))
return None