Skip to content

Commit

Permalink
Merge pull request #29978 from nextcloud/backport/29974/stable22
Browse files Browse the repository at this point in the history
[stable22] Let repair step query exceptions bubble up
  • Loading branch information
come-nc authored Nov 30, 2021
2 parents e583ef3 + 322f323 commit 661ed65
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/private/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Throwable;

class Repair implements IOutput {

Expand Down Expand Up @@ -140,9 +141,15 @@ public function addStep($repairStep) {
$s = \OC::$server->query($repairStep);
} catch (QueryException $e) {
if (class_exists($repairStep)) {
$s = new $repairStep();
try {
// Last resort: hope there are no constructor arguments
$s = new $repairStep();
} catch (Throwable $inner) {
// Well, it was worth a try
throw new \Exception("Repair step '$repairStep' can't be instantiated: " . $e->getMessage(), 0, $e);
}
} else {
throw new \Exception("Repair step '$repairStep' is unknown");
throw new \Exception("Repair step '$repairStep' is unknown", 0, $e);
}
}

Expand Down

0 comments on commit 661ed65

Please sign in to comment.