Skip to content

Commit 086e79e

Browse files
Merge pull request #29979 from nextcloud/backport/29974/stable21
[stable21] Let repair step query exceptions bubble up
2 parents 46a264b + 56fb217 commit 086e79e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/private/Repair.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
use OCP\Migration\IRepairStep;
8080
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
8181
use Symfony\Component\EventDispatcher\GenericEvent;
82+
use Throwable;
8283

8384
class Repair implements IOutput {
8485

@@ -131,9 +132,15 @@ public function addStep($repairStep) {
131132
$s = \OC::$server->query($repairStep);
132133
} catch (QueryException $e) {
133134
if (class_exists($repairStep)) {
134-
$s = new $repairStep();
135+
try {
136+
// Last resort: hope there are no constructor arguments
137+
$s = new $repairStep();
138+
} catch (Throwable $inner) {
139+
// Well, it was worth a try
140+
throw new \Exception("Repair step '$repairStep' can't be instantiated: " . $e->getMessage(), 0, $e);
141+
}
135142
} else {
136-
throw new \Exception("Repair step '$repairStep' is unknown");
143+
throw new \Exception("Repair step '$repairStep' is unknown", 0, $e);
137144
}
138145
}
139146

0 commit comments

Comments
 (0)