Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- A `#[Schedule]` method whose event could not be placed in WordPress cron was logged without the reason. The log entry now carries the exception, under the `exception` key of its context, as the other discoveries do.

## [1.0.5] - 2026-12-03

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Services/ScheduleDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ private function placeWordPressCron(string $hookName, string $interval, array $a
{
try {
$this->engine()->schedule(new Event($hookName, $this->engine()->now(), $interval, $args));
} catch (ScheduleException) {
$this->logger?->error('Failed to schedule WordPress cron event for hook: '.$hookName);
} catch (ScheduleException $scheduleException) {
$this->logger?->error('Failed to schedule WordPress cron event for hook: '.$hookName, ['exception' => $scheduleException]);
}
}

Expand Down
5 changes: 4 additions & 1 deletion tests/Unit/ScheduleSurfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ public function events(): array
}
};
$this->engine->useDriver($refusing);
$this->logger->shouldReceive('error')->once()->with('Failed to schedule WordPress cron event for hook: surface_plain');
$this->logger->shouldReceive('error')->once()->with(
'Failed to schedule WordPress cron event for hook: surface_plain',
Mockery::on(fn (array $context): bool => $context['exception'] instanceof ScheduleException && $context['exception']->getMessage() === 'refused'),
);

($this->discover)(PlainSurfaceJobs::class)->apply();
});
Expand Down
Loading