Log when beacon fails to send

This commit is contained in:
James Brooks 2017-01-02 17:09:55 +00:00
parent a2bbb18f79
commit 34b0432ceb
4 changed files with 36 additions and 3 deletions

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Events\Beacon;
use CachetHQ\Cachet\Bus\Events\Beacon\BeaconFailedToSendEvent;
/**
* This is the log beacon failed handler.
*
* @author James Brooks <james@alt-three.com>
*/
class LogBeaconFailedHandler
{
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Bus\Events\Beacon\BeaconFailedToSendEvent $event
*
* @return void
*/
public function handle(BeaconFailedToSendEvent $event)
{
logger('Beacon failed.');
}
}

View File

@ -22,7 +22,7 @@ class EventServiceProvider extends ServiceProvider
*/
protected $listen = [
'CachetHQ\Cachet\Bus\Events\Beacon\BeaconFailedToSendEvent' => [
//
'CachetHQ\Cachet\Bus\Handlers\Events\Beacon\LogBeaconFailedHandler',
],
'CachetHQ\Cachet\Bus\Events\Beacon\BeaconWasSentEvent' => [
//

View File

@ -111,7 +111,6 @@ class Beacon implements BeaconContract
'json' => $payload,
]);
} catch (Exception $e) {
// TODO: Log a warning that the beacon could not be sent.
event(new BeaconFailedToSendEvent());
return;

View File

@ -22,7 +22,7 @@ class BeaconFailedToSendEventTest extends AbstractBeaconEventTestCase
{
protected function objectHasHandlers()
{
return false;
return true;
}
protected function getObjectAndParams()