Do not fail hard on new user mail error

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-07-02 08:04:56 +02:00
parent 7fbfa5cd99
commit 33409319be
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 3 additions and 2 deletions

View File

@ -328,12 +328,13 @@ class UsersController extends AUserData {
$emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken); $emailTemplate = $this->newUserMailHelper->generateTemplate($newUser, $generatePasswordResetToken);
$this->newUserMailHelper->sendMail($newUser, $emailTemplate); $this->newUserMailHelper->sendMail($newUser, $emailTemplate);
} catch (\Exception $e) { } catch (\Exception $e) {
// Mail could be failing hard or just be plain not configured
// Logging error as it is the hardest of the two
$this->logger->logException($e, [ $this->logger->logException($e, [
'message' => "Can't send new user mail to $email", 'message' => "Unable to send the invitation mail to $email",
'level' => ILogger::ERROR, 'level' => ILogger::ERROR,
'app' => 'ocs_api', 'app' => 'ocs_api',
]); ]);
throw new OCSException('Unable to send the invitation mail', 109);
} }
} }