You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible for there to be a way to set a task specific onError callback function? Right now, an onError function can be set but there's no way (afaik) to limit it to a single task like before() and after().
It would be nice if onError() can be used just like before() and after() callbacks.
Basically a post-execution callback that's only called if the execution of the event (not schedule) is unsucessful.
Example
In addition to this:
use Crunz\Schedule;
$schedule = new Schedule();
$task = $schedule->run('command/to/run');
$task->everyFiveMinutes();
$schedule
->onError(function() {
// Send mail
})
->onError(function() {
// Do something else
});
return $schedule;
It would be nice if this was supported :
use Crunz\Schedule;
$schedule = new Schedule();
$task = $schedule->run('command/to/run');
$task->everyFiveMinutes();
$task->onError(function() {
// Send mail
})
->onError(function() {
// Do something else
});
return $schedule;
The text was updated successfully, but these errors were encountered:
Hello, actually it is possible internally to do this. I've implemented it as a part of #261. IMO it should be easy to make Event::addErrorCallback public, it just need some unit tests.
Would you like to provide a PR?
Description
Is it possible for there to be a way to set a task specific onError callback function? Right now, an onError function can be set but there's no way (afaik) to limit it to a single task like before() and after().
It would be nice if onError() can be used just like before() and after() callbacks.
Basically a post-execution callback that's only called if the execution of the event (not schedule) is unsucessful.
Example
In addition to this:
It would be nice if this was supported :
The text was updated successfully, but these errors were encountered: