PluginErrorEvent 5.46.0
Extends PluginEvent
Implements Cancellable
Called when code belonging to a plugin throws an exception or error that the plugin did not catch, and the server isolated it instead of crashing (see \pocketmine\plugin\PluginFaultHandler).
This is intended for monitoring and error-reporting plugins.
Cancelling the event suppresses the server's default error log for this failure. The failure still counts towards the plugin's error limit, so a plugin that keeps failing will be disabled regardless.
This event is never called for failures of handlers of this event itself, to avoid infinite recursion.
Methods
__construct()
public function __construct(\pocketmine\plugin\Plugin $plugin, \Throwable $throwable, string $context, int $recentErrorCount, bool $pluginWillBeDisabled)getContext()
public function getContext() : stringReturns a human-readable description of the entry point in which the failure occurred, e.g. "event handler Foo::onJoin(PlayerJoinEvent)" or "command /foo".
getRecentErrorCount()
public function getRecentErrorCount() : intReturns the number of unhandled errors the plugin has had within the configured error window, including this one.
getThrowable()
public function getThrowable() : \ThrowableReturns the exception or error that was thrown by the plugin.
willPluginBeDisabled()
public function willPluginBeDisabled() : boolReturns whether this failure made the plugin reach its error limit, which means it will be disabled right after this event.
