Skip to content

Commit eaaded5

Browse files
committed
Handle email send failure gracefully
1 parent a199360 commit eaaded5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Http/Controllers/Auth/RegisterController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Auth\Middleware\RedirectIfAuthenticated;
1212
use Illuminate\Foundation\Auth\RegistersUsers;
1313
use Illuminate\Http\JsonResponse;
14+
use Symfony\Component\Mailer\Exception\HttpTransportException;
1415

1516
class RegisterController extends Controller
1617
{
@@ -51,7 +52,11 @@ public function __construct()
5152
*/
5253
public function register(RegisterRequest $request)
5354
{
54-
event(new Registered($user = $this->create($request)));
55+
try {
56+
event(new Registered($user = $this->create($request)));
57+
} catch (HttpTransportException $e) {
58+
// Failed to send email verification...
59+
}
5560

5661
session()->forget('githubData');
5762

0 commit comments

Comments
 (0)