From c1c158ccdabf0460c23f183b66012a22d570fe6a Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 19 Nov 2024 07:40:46 +0000 Subject: [PATCH] Fix errors in Core namespace --- src/Core/Lock/Type/DatabaseLock.php | 4 ++++ src/Core/PConfig/Repository/PConfig.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Core/Lock/Type/DatabaseLock.php b/src/Core/Lock/Type/DatabaseLock.php index 9a00791007..9699522807 100644 --- a/src/Core/Lock/Type/DatabaseLock.php +++ b/src/Core/Lock/Type/DatabaseLock.php @@ -182,7 +182,11 @@ class DatabaseLock extends AbstractLock } $stmt = $this->dba->select('locks', ['name'], $where); + } catch (\Exception $exception) { + throw new LockPersistenceException(sprintf('Cannot get lock with prefix %s', $prefix), $exception); + } + try { $keys = []; while ($key = $this->dba->fetch($stmt)) { array_push($keys, $key['name']); diff --git a/src/Core/PConfig/Repository/PConfig.php b/src/Core/PConfig/Repository/PConfig.php index 39a5c31800..0b47fad67d 100644 --- a/src/Core/PConfig/Repository/PConfig.php +++ b/src/Core/PConfig/Repository/PConfig.php @@ -60,7 +60,11 @@ class PConfig } else { $configs = $this->db->select(static::$table_name, ['cat', 'v', 'k'], ['cat' => $cat, 'uid' => $uid]); } + } catch (\Exception $exception) { + throw new PConfigPersistenceException(sprintf('Cannot load config category "%s" for user %d', $cat, $uid), $exception); + } + try { while ($config = $this->db->fetch($configs)) { $key = $config['k']; $value = ValueConversion::toConfigValue($config['v']); @@ -71,7 +75,7 @@ class PConfig } } } catch (\Exception $exception) { - throw new PConfigPersistenceException(sprintf('Cannot load config category %s for user %d', $cat, $uid), $exception); + throw new PConfigPersistenceException(sprintf('Cannot load config category "%s" for user %d', $cat, $uid), $exception); } finally { $this->db->close($configs); }