File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 3
3
namespace Illuminate \Console \Scheduling ;
4
4
5
5
use Illuminate \Console \Command ;
6
+ use Illuminate \Console \Events \ScheduledTaskFailed ;
6
7
use Illuminate \Console \Events \ScheduledTaskFinished ;
7
8
use Illuminate \Console \Events \ScheduledTaskSkipped ;
8
9
use Illuminate \Console \Events \ScheduledTaskStarting ;
@@ -148,6 +149,8 @@ protected function runEvent($event)
148
149
149
150
$ this ->eventsRan = true ;
150
151
} catch (Throwable $ e ) {
152
+ $ this ->dispatcher ->dispatch (new ScheduledTaskFailed ($ event , $ e ));
153
+
151
154
$ this ->handler ->report ($ e );
152
155
}
153
156
}
You can’t perform that action at this time.
0 commit comments