diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-11-30 08:56:41 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-11-30 09:47:39 +0100 |
commit | f68ab008118383cf70b02d942c06d0a27f4e15d3 (patch) | |
tree | 374574e4dbf38933f00e37a5e53cebc809d03131 /lib/private/Repair.php | |
parent | 6d357d0f3a46422175386cbeb7656c216902df59 (diff) | |
download | nextcloud-server-f68ab008118383cf70b02d942c06d0a27f4e15d3.tar.gz nextcloud-server-f68ab008118383cf70b02d942c06d0a27f4e15d3.zip |
Let repair step query exceptions bubble up
And hide the type error caused by a constructor call with missing
arguments.
`new $repairStep();` only works for the rare case that no arguments are
required. Anything else will throw. Then we previously hid the trace of
the more important query exception.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Repair.php')
-rw-r--r-- | lib/private/Repair.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 688b053fa12..ea118aa1a4c 100644 --- a/lib/private/Repair.php +++ b/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,7 +141,13 @@ 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"); } |