Commit e5725846 authored by Baudouin Feildel's avatar Baudouin Feildel
Browse files

Fix error handling

parent f83c259b
Pipeline #991 passed with stage
in 1 minute and 21 seconds
......@@ -9,7 +9,7 @@ use App\Entity\Lizmap\LizmapUser;
use App\Entity\User;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectManager;
use Error;
use Exception;
use RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
......@@ -85,12 +85,12 @@ class AppAutomationUser extends Command
$modified = $this->ensureUser($user, $email, $name, $password, $lizmapLogin, UserStatus::STATUS_NORMAL);
break;
}
} catch (Error $error) {
$output->writeln("error: " . $error->getMessage());
} catch (Exception $exception) {
$output->writeln("error: " . $exception->getMessage());
return 1;
}
$output->writeln($modified ? "modified" : "ok");
$output->writeln($modified ? "changed" : "ok");
return 0;
}
......@@ -148,7 +148,7 @@ class AppAutomationUser extends Command
$user->setLizmapLogin($lizmapLogin);
$modified = true;
} else {
throw new RuntimeException("Lizmap user $lizmapLogin not found");
throw new RuntimeException("Lizmap user '$lizmapLogin' not found");
}
}
......@@ -191,7 +191,7 @@ class AppAutomationUser extends Command
if ($lizmapUser !== null) {
$user->setLizmapLogin($lizmapLogin);
} else {
throw new RuntimeException("Lizmap user $lizmapLogin not found");
throw new RuntimeException("Lizmap user '$lizmapLogin' not found");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment