Skip to content

Commit c7d5f98

Browse files
Merge pull request #29977 from nextcloud/backport/29974/stable23
[stable23] Let repair step query exceptions bubble up
2 parents 17a659e + 3b2122f commit c7d5f98

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lib/private/Repair.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
use Psr\Log\LoggerInterface;
8181
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
8282
use Symfony\Component\EventDispatcher\GenericEvent;
83+
use Throwable;
8384

8485
class Repair implements IOutput {
8586

@@ -140,9 +141,15 @@ public function addStep($repairStep) {
140141
$s = \OC::$server->query($repairStep);
141142
} catch (QueryException $e) {
142143
if (class_exists($repairStep)) {
143-
$s = new $repairStep();
144+
try {
145+
// Last resort: hope there are no constructor arguments
146+
$s = new $repairStep();
147+
} catch (Throwable $inner) {
148+
// Well, it was worth a try
149+
throw new \Exception("Repair step '$repairStep' can't be instantiated: " . $e->getMessage(), 0, $e);
150+
}
144151
} else {
145-
throw new \Exception("Repair step '$repairStep' is unknown");
152+
throw new \Exception("Repair step '$repairStep' is unknown", 0, $e);
146153
}
147154
}
148155

0 commit comments

Comments
 (0)