/** * Allocates a new exception. * * An exception is built with a formatted message, a code (an ID), and an * array that contains the list of formatted string for the message. If * chaining, a previous exception can be added. */ public function __construct( string $message, int $code = 0, $arguments = [], ?\Throwable $previous = null ) { parent::__construct($message, $code, $arguments, $previous); if (false === Event::eventExists('hoa://Event/Exception')) { Event::register('hoa://Event/Exception', __CLASS__); } $this->send(); return; } /** * Sends the exception on `hoa://Event/Exception`. */ public function send() { Event::notify( 'hoa://Event/Exception', $this, new EventBucket($this) ); } }