mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-05 17:07:03 +00:00
migrated some exceptions to use templates
fixed missed hard coded value in template fixed listing of channels in channel groups fixed template loading
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.command.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
|
||||
public class ChannelGroupException extends AbstractoRunTimeException {
|
||||
public ChannelGroupException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package dev.sheldan.abstracto.core.command.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ChannelGroupExistsException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String name;
|
||||
|
||||
public ChannelGroupExistsException(String name) {
|
||||
super("");
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "channel_group_exists_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("name", this.name);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package dev.sheldan.abstracto.core.command.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ChannelGroupNotFoundException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String name;
|
||||
private List<String> available;
|
||||
|
||||
public ChannelGroupNotFoundException(String key, List<String> available) {
|
||||
super("");
|
||||
this.name = key;
|
||||
this.available = available;
|
||||
}
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "channel_group_not_found_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("name", this.name);
|
||||
param.put("available", String.join(", ", this.available));
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class ConfigurationException extends AbstractoRunTimeException {
|
||||
public ConfigurationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ConfigurationKeyNotFoundException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String key;
|
||||
|
||||
public ConfigurationKeyNotFoundException(String key) {
|
||||
super("");
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "config_key_not_found_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("key", this.key);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class EmoteException extends AbstractoRunTimeException {
|
||||
public EmoteException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class EmoteNotDefinedException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String emoteKey;
|
||||
|
||||
public EmoteNotDefinedException(String key) {
|
||||
super("");
|
||||
this.emoteKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "emote_not_defined_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("emoteKey", this.emoteKey);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class EmoteNotFoundException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String emoteKey;
|
||||
private List<String> available;
|
||||
|
||||
public EmoteNotFoundException(String key, List<String> availableEmotes) {
|
||||
super("");
|
||||
this.emoteKey = key;
|
||||
this.available = availableEmotes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "emote_not_found_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("emoteKey", this.emoteKey);
|
||||
param.put("available", String.join(",", this.available));
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class FeatureDisabledException extends AbstractoRunTimeException {
|
||||
public FeatureDisabledException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,19 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class GuildException extends AbstractoRunTimeException {
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
public class GuildException extends AbstractoRunTimeException implements Templatable {
|
||||
public GuildException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class PostTargetException extends AbstractoRunTimeException {
|
||||
public PostTargetException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class PostTargetNotFoundException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String postTargetKey;
|
||||
private List<String> availableTargets;
|
||||
|
||||
public PostTargetNotFoundException(String key, List<String> available) {
|
||||
super("");
|
||||
this.postTargetKey = key;
|
||||
this.availableTargets = available;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "post_target_not_found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("key", this.postTargetKey);
|
||||
param.put("available", String.join(",", this.availableTargets));
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PostTargetNotValidException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private String postTargetKey;
|
||||
|
||||
public PostTargetNotValidException(String key) {
|
||||
super("");
|
||||
this.postTargetKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "post_target_not_valid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("key", this.postTargetKey);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class RoleException extends AbstractoRunTimeException {
|
||||
public RoleException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class RoleNotFoundInDBException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private Long roleId;
|
||||
private Long serverId;
|
||||
|
||||
public RoleNotFoundInDBException(Long roleId, Long serverId) {
|
||||
super("");
|
||||
this.roleId = roleId;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "role_not_found_in_db_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, Long> param = new HashMap<>();
|
||||
param.put("roleId", this.roleId);
|
||||
param.put("serverId", this.serverId);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class RoleNotFoundInGuildException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
private Long roleId;
|
||||
private Long serverId;
|
||||
|
||||
public RoleNotFoundInGuildException(Long roleId, Long serverId) {
|
||||
super("");
|
||||
this.roleId = roleId;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "role_not_found_in_guild_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
HashMap<String, Long> param = new HashMap<>();
|
||||
param.put("roleId", this.roleId);
|
||||
param.put("serverId", this.serverId);
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class UndoActionException extends AbstractoRunTimeException {
|
||||
public UndoActionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.exception;
|
||||
|
||||
public class UserException extends AbstractoRunTimeException {
|
||||
public UserException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ public interface ChannelGroupManagementService {
|
||||
void removeChannelFromChannelGroup(AChannelGroup channelGroup, AChannel channel);
|
||||
AChannelGroup findByNameAndServer(String name, AServer server);
|
||||
List<AChannelGroup> findAllInServer(AServer server);
|
||||
List<String> getAllAvailableAsString(AServer server);
|
||||
List<AChannelGroup> findAllInServer(Long serverId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user