Skip to content

Commit 1d2055b

Browse files
authored
wip (#33427)
1 parent 2bdb713 commit 1d2055b

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Illuminate\Console\Events;
4+
5+
use Illuminate\Console\Scheduling\Event;
6+
use Throwable;
7+
8+
class ScheduledTaskFailed
9+
{
10+
/**
11+
* The scheduled event that failed.
12+
*
13+
* @var \Illuminate\Console\Scheduling\Event
14+
*/
15+
public $task;
16+
17+
/**
18+
* The exception that was thrown.
19+
*
20+
* @var \Throwable
21+
*/
22+
public $exception;
23+
24+
/**
25+
* Create a new event instance.
26+
*
27+
* @param \Illuminate\Console\Scheduling\Event $task
28+
* @param \Throwable $exception
29+
*/
30+
public function __construct(Event $task, Throwable $exception)
31+
{
32+
$this->task = $task;
33+
$this->exception = $exception;
34+
}
35+
}

src/Illuminate/Console/Scheduling/ScheduleRunCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Console\Scheduling;
44

55
use Illuminate\Console\Command;
6+
use Illuminate\Console\Events\ScheduledTaskFailed;
67
use Illuminate\Console\Events\ScheduledTaskFinished;
78
use Illuminate\Console\Events\ScheduledTaskSkipped;
89
use Illuminate\Console\Events\ScheduledTaskStarting;
@@ -148,6 +149,8 @@ protected function runEvent($event)
148149

149150
$this->eventsRan = true;
150151
} catch (Throwable $e) {
152+
$this->dispatcher->dispatch(new ScheduledTaskFailed($event, $e));
153+
151154
$this->handler->report($e);
152155
}
153156
}

0 commit comments

Comments
 (0)