mirror of
https://github.com/nextcloud/server.git
synced 2026-03-25 03:43:45 -04:00
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>
This commit is contained in:
parent
46a264b2a2
commit
bb91d5bd69
1 changed files with 8 additions and 1 deletions
|
|
@ -79,6 +79,7 @@ use OCP\Migration\IOutput;
|
|||
use OCP\Migration\IRepairStep;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
use Throwable;
|
||||
|
||||
class Repair implements IOutput {
|
||||
|
||||
|
|
@ -131,7 +132,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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue