Since: 4.0.0

class ErrorEvent extends AbstractEvent

Event class for representing the application's onError event

Traits

Returns the most suitable event class for a Joomla core event name

Methods

static string
getEventClassByEventName(string $eventName)

Get the concrete event class name for the given event name.

static AbstractEvent
create(string $eventName, array $arguments = [])

Creates a new CMS event object for a given event name and subject. The following arguments must be given: subject object The subject of the event. This is the core object you are going to manipulate.

__construct(string $name, array $arguments = [])

Constructor. Overridden to go through the argument setters.

mixed
getArgument(string $name, mixed $default = null)

Get an event argument value.

$this
setArgument(string $name, mixed $value)

Add argument to event.

AbstractApplication
getApplication()

Get the event's application object

getError()

Get the event's error object

void
setError(Throwable $error)

Set the event's error object

Details

static protected string getEventClassByEventName(string $eventName)

Since: 4.2.0

Get the concrete event class name for the given event name.

This method falls back to the generic Joomla\Event\Event class if the event name is unknown to this trait.

Parameters

string $eventName

The event name

Return Value

string

The event class name

static AbstractEvent create(string $eventName, array $arguments = [])

Since: 4.0.0

Creates a new CMS event object for a given event name and subject. The following arguments must be given: subject object The subject of the event. This is the core object you are going to manipulate.

eventClass string The Event class name. If you do not provide it Joomla\CMS\Events\ will be used.

Parameters

string $eventName

The name of the event, e.g. onTableBeforeLoad

array $arguments

Additional arguments to pass to the event

Return Value

AbstractEvent

Exceptions

BadMethodCallException

__construct(string $name, array $arguments = [])

Since: 4.0.0

Constructor. Overridden to go through the argument setters.

Parameters

string $name

The event name.

array $arguments

The event arguments.

mixed getArgument(string $name, mixed $default = null)

Since: 4.0.0

Get an event argument value.

It will use a pre-processing method if one exists. The method has the signature:

onGet($value): mixed

where:

$value is the value currently stored in the $arguments array of the event It returns the value to return to the caller.

Parameters

string $name

The argument name.

mixed $default

The default value if not found.

Return Value

mixed

The argument value or the default value.

$this setArgument(string $name, mixed $value)

Since: 4.0.0

Add argument to event.

It will use a pre-processing method if one exists. The method has the signature:

onSet($value): mixed

where:

$value is the value being set by the user It returns the value to return to set in the $arguments array of the event.

Parameters

string $name

Argument name.

mixed $value Value.

Return Value

$this

AbstractApplication getApplication()

Since: 4.0.0

Get the event's application object

Return Value

AbstractApplication

Throwable getError()

Since: 4.0.0

Get the event's error object

Return Value

Throwable

void setError(Throwable $error)

Since: 4.0.0

Set the event's error object

Parameters

Throwable $error

The new error to process

Return Value

void