Breaking: #110637 - Scheduler repository throws InvalidTaskException 

See forge#110637

Description 

The SchedulerTaskRepository::findByUid() and SchedulerTaskRepository::findNextExecutableTask() methods now throw \TYPO3\CMS\Scheduler\Exception\InvalidTaskException when a Scheduler task cannot be deserialized or is otherwise invalid. Previously, the global \UnexpectedValueException was thrown.

Impact 

Code that catches \UnexpectedValueException when retrieving invalid Scheduler tasks will no longer catch the exception.

Affected installations 

Installations are affected when custom extension code directly uses SchedulerTaskRepository and handles invalid tasks by catching \UnexpectedValueException .

Migration 

Catch InvalidTaskException instead of \UnexpectedValueException .

Before:

try {
    $task = $schedulerTaskRepository->findByUid($taskUid);
} catch (\UnexpectedValueException) {
    // Handle the invalid task.
}
Copied!

After:

use TYPO3\CMS\Scheduler\Exception\InvalidTaskException;

try {
    $task = $schedulerTaskRepository->findByUid($taskUid);
} catch (InvalidTaskException) {
    // Handle the invalid task.
}
Copied!

Apply the same change when calling findNextExecutableTask() .