News: Catch all throwable exceptions
This commit is contained in:
parent
86da8758a4
commit
49300900d6
|
@ -8,9 +8,9 @@ use Engelsystem\Mail\EngelsystemMailer;
|
|||
use Engelsystem\Models\News as NewsModel;
|
||||
use Engelsystem\Models\User\Settings as UserSettings;
|
||||
use Engelsystem\Models\User\User;
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Throwable;
|
||||
|
||||
class News
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class News
|
|||
$template,
|
||||
['title' => $news->title, 'news' => $news, 'username' => $user->displayName]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
} catch (Throwable $e) {
|
||||
$this->log->error(
|
||||
'Unable to send email "{title}" to user {user} with {exception}',
|
||||
['title' => $subject, 'user' => $user->name, 'exception' => $e]
|
||||
|
|
|
@ -12,10 +12,10 @@ use Engelsystem\Models\User\Settings;
|
|||
use Engelsystem\Models\User\User;
|
||||
use Engelsystem\Test\Unit\HasDatabase;
|
||||
use Engelsystem\Test\Unit\TestCase;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\Test\TestLogger;
|
||||
use Symfony\Component\Mailer\Exception\TransportException;
|
||||
|
||||
class NewsTest extends TestCase
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class NewsTest extends TestCase
|
|||
$this->assertEquals('Foo', array_values($data)[0]);
|
||||
|
||||
if ($i++ > 0) { // On second run
|
||||
throw new TransportException('Oops');
|
||||
throw new Exception('Oops');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue