From 96ce6587dfb7452532131f2de7b7f180668e28cf Mon Sep 17 00:00:00 2001 From: Alexey Savchkov Date: Wed, 8 Jul 2026 23:56:59 +0700 Subject: [PATCH 1/2] Process the exception if pg_config is not found --- src/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 276e7b0a..39bdc9d1 100644 --- a/src/utils.py +++ b/src/utils.py @@ -263,7 +263,12 @@ def cache_pg_config_data(cmd): return cache_pg_config_data(cmd) # try plain name - return cache_pg_config_data("pg_config") + try: + pg_config_data = cache_pg_config_data("pg_config") + except Exception: + raise Exception( + "Failed to determine how to start pg_config. Specify the path to pg_config in PG_CONFIG or the path to the Postgres directory containing it in PG_BIN, or put it into the system PATH.") + return pg_config_data def get_pg_version2(os_ops: OsOperations, bin_dir=None): From bebe038a11d4c8a00c264bbb69dac83eaa493071 Mon Sep 17 00:00:00 2001 From: Alexey Savchkov Date: Thu, 9 Jul 2026 12:10:13 +0700 Subject: [PATCH 2/2] Raise InvalidOperationError --- src/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.py b/src/utils.py index 39bdc9d1..227c6525 100644 --- a/src/utils.py +++ b/src/utils.py @@ -14,7 +14,7 @@ from six import iteritems -from .exceptions import ExecUtilException +from .exceptions import ExecUtilException, InvalidOperationException from .config import testgres_config as tconf from .raise_error import RaiseError from .enums import NodeStatus @@ -266,8 +266,8 @@ def cache_pg_config_data(cmd): try: pg_config_data = cache_pg_config_data("pg_config") except Exception: - raise Exception( - "Failed to determine how to start pg_config. Specify the path to pg_config in PG_CONFIG or the path to the Postgres directory containing it in PG_BIN, or put it into the system PATH.") + raise InvalidOperationException( + "Failed to determine how to start pg_config. Either specify the path to pg_config in PG_CONFIG or specify the path to the Postgres directory containing pg_config in PG_BIN, or put pg_config into the system PATH.") return pg_config_data