Skip to content

PsrEventDispatcherErrorReporter

github-actions edited this page Mar 26, 2026 · 1 revision

This error reporter implementation MUST dispatch all reported exceptions as events using a PSR-14 compatible event dispatcher.

It SHALL provide a detailed event including the exception, callback description, and arguments. If the dispatcher throws an exception, this class MUST log the failure using error_log and MUST NOT throw further exceptions.


  • Full name: \FastForward\Defer\ErrorReporter\PsrEventDispatcherErrorReporter
  • This class is marked as final and can't be subclassed
  • This class implements: \FastForward\Defer\ErrorReporterInterface
  • This class is a Final class

Methods

__construct

Constructs a new PsrEventDispatcherErrorReporter instance.

public __construct(\Psr\EventDispatcher\EventDispatcherInterface $dispatcher): mixed

Parameters:

Parameter Type Description
$dispatcher \Psr\EventDispatcher\EventDispatcherInterface the PSR-14 event dispatcher to use for error reporting

report

Reports a throwable by dispatching a DeferredCallbackFailed event.

public report(\Throwable $throwable, callable|null $callback = null, array $args = []): void

This method MUST dispatch the exception as an event. If the dispatcher fails, the error MUST be logged.

Parameters:

Parameter Type Description
$throwable \Throwable the exception or error to report
$callback callable|null the related callback, if available
$args array arguments passed to the callback, if any

Clone this wiki locally