Skip to content

Commit

Permalink
wip (#33427)
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored Jul 3, 2020
1 parent 2bdb713 commit 1d2055b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Illuminate/Console/Events/ScheduledTaskFailed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Illuminate\Console\Events;

use Illuminate\Console\Scheduling\Event;
use Throwable;

class ScheduledTaskFailed
{
/**
* The scheduled event that failed.
*
* @var \Illuminate\Console\Scheduling\Event
*/
public $task;

/**
* The exception that was thrown.
*
* @var \Throwable
*/
public $exception;

/**
* Create a new event instance.
*
* @param \Illuminate\Console\Scheduling\Event $task
* @param \Throwable $exception
*/
public function __construct(Event $task, Throwable $exception)
{
$this->task = $task;
$this->exception = $exception;
}
}
3 changes: 3 additions & 0 deletions src/Illuminate/Console/Scheduling/ScheduleRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Console\Scheduling;

use Illuminate\Console\Command;
use Illuminate\Console\Events\ScheduledTaskFailed;
use Illuminate\Console\Events\ScheduledTaskFinished;
use Illuminate\Console\Events\ScheduledTaskSkipped;
use Illuminate\Console\Events\ScheduledTaskStarting;
Expand Down Expand Up @@ -148,6 +149,8 @@ protected function runEvent($event)

$this->eventsRan = true;
} catch (Throwable $e) {
$this->dispatcher->dispatch(new ScheduledTaskFailed($event, $e));

$this->handler->report($e);
}
}
Expand Down

0 comments on commit 1d2055b

Please sign in to comment.