Add exception reporting event

This commit is contained in:
Zach Brown
2016-02-29 20:24:35 -06:00
parent b007bb8264
commit 7c31d0a39b
12 changed files with 430 additions and 9 deletions

View File

@ -0,0 +1,36 @@
package com.destroystokyo.paper.exception;
import org.bukkit.plugin.Plugin;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Wrapper exception for all cases to which a plugin can be immediately blamed for
*/
public class ServerPluginException extends ServerException {
public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
super(message, cause);
this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
}
public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
super(cause);
this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
}
protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
super(message, cause, enableSuppression, writableStackTrace);
this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
}
private final Plugin responsiblePlugin;
/**
* Gets the plugin which is directly responsible for the exception being thrown
*
* @return plugin which is responsible for the exception throw
*/
public Plugin getResponsiblePlugin() {
return responsiblePlugin;
}
}