8000 Return console output instead of exception · Adldap2/Adldap2-Laravel@406d9e6 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 406d9e6

Browse files
authored
Return console output instead of exception
The command is currently throwing an exception, if no user were found. Since this exception is never and can't be catched, the function should rather return an information text instead of throwing this exception.
1 parent c2809bc commit 406d9e6

File tree

1 changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Commands/Console/Import.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public function handle()
6060
$count = count($users);
6161

6262
if ($count === 0) {
63-
throw new RuntimeException('There were no users found to import.');
63+
$this->info('There were no users found to import.');
64+
exit;
6465
} elseif ($count === 1) {
6566
$this->info("Found user '{$users[0]->getCommonName()}'.");
6667
} else {

0 commit comments

Comments
 (0)
0