PsrEventDispatcherErrorReporter

Class
Read only: Yes Final: Yes

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

Description

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.

Table of Contents

Interfaces

ErrorReporterInterface

This interface MUST be implemented by any class that reports exceptions from deferred callbacks.

Properties

 : EventDispatcherInterface

Methods

__construct()

Constructs a new PsrEventDispatcherErrorReporter instance.

 : mixed
report()

Reports a throwable by dispatching a DeferredCallbackFailed event.

 : void
Properties
Methods

__construct()

Public

Constructs a new PsrEventDispatcherErrorReporter instance.

public __construct(EventDispatcherInterface  $dispatcher) : mixed
Parameters
$dispatcher : EventDispatcherInterface

Description

the PSR-14 event dispatcher to use for error reporting

report()

Public

Reports a throwable by dispatching a DeferredCallbackFailed event.

public report(Throwable  $throwable[, callable|null  $callback = null][, array<string|int, mixed>  $args = []]) : void

Description

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

Parameters
$throwable : Throwable

Description

the exception or error to report

$callback : callable|null = null

Description

the related callback, if available

$args : array<string|int, mixed> = []

Description

arguments passed to the callback, if any