diff options
| -rwxr-xr-x | manage | 17 | ||||
| -rw-r--r-- | searx/__init__.py | 1 | ||||
| -rw-r--r-- | searx/metrics/error_recorder.py | 4 |
3 files changed, 14 insertions, 8 deletions
@@ -343,14 +343,17 @@ pyenv.install() { if pyenv.install.OK > /dev/null; then return 0 fi - pyenv - pyenv.OK || die 42 "error while build pyenv (${PY_ENV_BIN})" ( set -e - build_msg PYENV "[install] pip install -e 'searx${PY_SETUP_EXTRAS}'" - "${PY_ENV_BIN}/python" -m pip install -e ".${PY_SETUP_EXTRAS}" - buildenv - ) || die 42 "error while pip install (${PY_ENV_BIN})" + pyenv + build_msg PYENV "[install] pip install -e 'searx${PY_SETUP_EXTRAS}'" + "${PY_ENV_BIN}/python" -m pip install -e ".${PY_SETUP_EXTRAS}" + buildenv + ) + local exit_val=$? + if [ ! $exit_val -eq 0 ]; then + die 42 "error while pip install (${PY_ENV_BIN})" + fi } pyenv.uninstall() { @@ -462,7 +465,7 @@ themes.simple() { PYLINT_FILES=() while IFS= read -r line; do PYLINT_FILES+=("$line") -done <<< $(pylint.FILES) +done <<< "$(pylint.FILES)" # shellcheck disable=SC2119 main() { diff --git a/searx/__init__.py b/searx/__init__.py index 71e00a49a..6aac98713 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -22,6 +22,7 @@ from os.path import realpath, dirname, join, abspath, isfile searx_dir = abspath(dirname(__file__)) +searx_parent_dir = abspath(dirname(dirname(__file__))) engine_dir = dirname(realpath(__file__)) static_path = abspath(join(dirname(__file__), 'static')) settings, settings_load_message = searx.settings_loader.load_settings() diff --git a/searx/metrics/error_recorder.py b/searx/metrics/error_recorder.py index 2bf25fb0d..c5de008cc 100644 --- a/searx/metrics/error_recorder.py +++ b/searx/metrics/error_recorder.py @@ -5,7 +5,7 @@ from urllib.parse import urlparse from httpx import HTTPError, HTTPStatusError from searx.exceptions import (SearxXPathSyntaxException, SearxEngineXPathException, SearxEngineAPIException, SearxEngineAccessDeniedException) -from searx import logger +from searx import logger, searx_parent_dir errors_per_engines = {} @@ -117,6 +117,8 @@ def get_exception_classname(exc: Exception) -> str: def get_error_context(framerecords, exception_classname, log_message, log_parameters, secondary) -> ErrorContext: searx_frame = get_trace(framerecords) filename = searx_frame.filename + if filename.startswith(searx_parent_dir): + filename = filename[len(searx_parent_dir) + 1:] function = searx_frame.function line_no = searx_frame.lineno code = searx_frame.code_context[0].strip() |