summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-12-08 17:10:20 +0100
committerGitHub <noreply@github.com>2020-12-08 17:10:20 +0100
commit13a1eb6494fae366a16ee6de86581518a23a7b84 (patch)
treec153a0bbe008ef0cd673ff70250934ee4818a13c /lib
parent86a3b7e7bf419e2bf1acc687625d0ff8596d39dc (diff)
parentc1f28f8d357d313b95ebbcc95c7201cc773aa81f (diff)
downloadnextcloud-server-13a1eb6494fae366a16ee6de86581518a23a7b84.tar.gz
nextcloud-server-13a1eb6494fae366a16ee6de86581518a23a7b84.zip
Merge pull request #24598 from nextcloud/techdebt/noid/wrap-the-exception-to-make-debuggin-easier
Make debugging migration exceptions easier
Diffstat (limited to 'lib')
-rw-r--r--lib/private/DB/MigrationService.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index 9c94cbc61fa..27e03318d6b 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -27,6 +27,7 @@
namespace OC\DB;
+use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\Index;
@@ -421,7 +422,13 @@ class MigrationService {
// read known migrations
$toBeExecuted = $this->getMigrationsToExecute($to);
foreach ($toBeExecuted as $version) {
- $this->executeStep($version, $schemaOnly);
+ try {
+ $this->executeStep($version, $schemaOnly);
+ } catch (DriverException $e) {
+ // The exception itself does not contain the name of the migration,
+ // so we wrap it here, to make debugging easier.
+ throw new \Exception('Database error when running migration ' . $to . ' for app ' . $this->getApp(), 0, $e);
+ }
}
}