Browse Source

Merge pull request #29974 from nextcloud/fix/repair-step-query-exception-bubble

Let repair step query exceptions bubble up
pull/29966/head
Christoph Wurst 4 years ago
committed by GitHub
parent
commit
2c3cf86ad3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      lib/private/Repair.php

11
lib/private/Repair.php

@ -80,6 +80,7 @@ use OCP\Migration\IRepairStep;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Throwable;
class Repair implements IOutput {
@ -140,9 +141,15 @@ class Repair implements IOutput {
$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);
}
}

Loading…
Cancel
Save