moved some more templates to template config

fixed usage of post target exceptions
This commit is contained in:
Sheldan
2020-05-13 17:45:55 +02:00
parent 80505d1014
commit cb1abaed7d
32 changed files with 34 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ package dev.sheldan.abstracto.core.service;
import dev.sheldan.abstracto.core.config.DynamicKeyLoader;
import dev.sheldan.abstracto.core.exception.ChannelNotFoundException;
import dev.sheldan.abstracto.core.exception.GuildException;
import dev.sheldan.abstracto.core.exception.PostTargetNotFoundException;
import dev.sheldan.abstracto.core.exception.PostTargetNotValidException;
import dev.sheldan.abstracto.core.service.management.PostTargetManagement;
import dev.sheldan.abstracto.core.models.database.PostTarget;
@@ -70,7 +71,7 @@ public class PostTargetServiceBean implements PostTargetService {
return postTarget;
} else {
log.error("PostTarget {} in server {} was not found!", postTargetName, serverId);
throw new PostTargetNotValidException(postTargetName);
throw new PostTargetNotFoundException(postTargetName);
}
}
@@ -171,7 +172,7 @@ public class PostTargetServiceBean implements PostTargetService {
public void throwIfPostTargetIsNotDefined(String name, Long serverId) {
PostTarget postTarget = postTargetManagement.getPostTarget(name, serverId);
if(postTarget == null) {
throw new PostTargetNotValidException(name);
throw new PostTargetNotValidException(name, dynamicKeyLoader.getPostTargetsAsList());
}
}

View File

@@ -2,7 +2,7 @@ package dev.sheldan.abstracto.core.service.management;
import dev.sheldan.abstracto.core.config.DynamicKeyLoader;
import dev.sheldan.abstracto.core.exception.ChannelNotFoundException;
import dev.sheldan.abstracto.core.exception.PostTargetNotFoundException;
import dev.sheldan.abstracto.core.exception.PostTargetNotValidException;
import dev.sheldan.abstracto.core.models.database.AChannel;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.PostTarget;
@@ -36,7 +36,7 @@ public class PostTargetManagementBean implements PostTargetManagement {
@Override
public PostTarget createPostTarget(String name, AServer server, AChannel targetChannel) {
if(!postTargetService.validPostTarget(name)) {
throw new PostTargetNotFoundException(name, dynamicKeyLoader.getPostTargetsAsList());
throw new PostTargetNotValidException(name, dynamicKeyLoader.getPostTargetsAsList());
}
log.info("Creating post target {} pointing towards {}", name, targetChannel);
PostTarget build = PostTarget.builder().name(name).channelReference(targetChannel).serverReference(server).build();

View File

@@ -1 +1 @@
Command was not found.
<#include "command_not_found_text">

View File

@@ -1 +1 @@
Feature has been disabled. Necessary feature is: <#include "${featureConfig.feature.key}_feature">, you can enable it by executing `enable ${featureConfig.feature.key}`.
<#assign featureName><#include "${featureConfig.feature.key}_feature"></#assign><#assign featureKey>${featureConfig.feature.key}</#assign><#include "feature_disabled_text">

View File

@@ -1 +1 @@
Feature ${featureName} not available. The available features are: ${availableFeatures?join(", ")}
<#assign availableFeatures>${availableFeatures?join(", ")}</#assign><#include "feature_not_found_text">

View File

@@ -1 +1 @@
The targeted user is immune against this command, because of the role: ${role.name}.
<#assign roleName>${role.name}</#assign> <#include "immune_role_text">

View File

@@ -1 +1 @@
The necessary parameters were not found. A '${class.simpleName}' was expected as '${parameterName}'. Consult help to see the correct syntax.
<#assign expectedType>${class.simpleName}</#assign><#include "incorrect_parameters_text">

View File

@@ -1 +1 @@
Insufficient parameters: ${parameterName} was not found.
<#include "insufficient_parameters_text">

View File

@@ -1 +1 @@
You lack the necessary role to execute this command. One of the following is needed: <#list allowedRoles as role>${role.name}<#sep>,<#else>None configured.</#list>
<#assign roles><#list allowedRoles as role>${role.name}<#sep>,<#else>None configured.</#list></#assign><#include "insufficient_role_text">

View File

@@ -1 +1 @@
The parameter ${parameterName} had a too large value: ${actualLength}. The maximum is: ${maximumLength}.
<#include "parameter_too_long_text">