mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 07:25:54 +00:00
dbupdater: catch PDO exception instead of internal errors since we're using those now; log queries while updating
This commit is contained in:
@@ -41,13 +41,19 @@ class DbUpdater {
|
||||
$this->pdo->beginTransaction();
|
||||
|
||||
foreach ($lines as $line) {
|
||||
|
||||
if ($html_output)
|
||||
print "<pre>$line</pre>";
|
||||
else
|
||||
print "\t$line\n";
|
||||
|
||||
if (strpos($line, "--") !== 0 && $line) {
|
||||
if (!$this->pdo->query($line)) {
|
||||
try {
|
||||
$this->pdo->query($line); // PDO returns errors as exceptions now
|
||||
} catch (PDOException $e) {
|
||||
if ($html_output) {
|
||||
print_notice("Query: $line");
|
||||
print_error("Error: " . implode(", ", $this->pdo->errorInfo()));
|
||||
} else {
|
||||
Debug::log("Query: $line");
|
||||
Debug::log("Error: " . implode(", ", $this->pdo->errorInfo()));
|
||||
}
|
||||
|
||||
@@ -73,4 +79,4 @@ class DbUpdater {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user