merged exceptions for setup steps to one common exception, which contains the concrete exception

added exception handling for incorrect mod mail category id
This commit is contained in:
Sheldan
2020-05-26 11:48:12 +02:00
parent 158d957eee
commit a682428028
15 changed files with 33 additions and 59 deletions

View File

@@ -0,0 +1,20 @@
package dev.sheldan.abstracto.modmail.setup;
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
import dev.sheldan.abstracto.templating.Templatable;
public class InvalidCategoryException extends AbstractoRunTimeException implements Templatable {
public InvalidCategoryException() {
super("");
}
@Override
public String getTemplateName() {
return "setup_category_not_valid_exception";
}
@Override
public Object getTemplateModel() {
return new Object();
}
}

View File

@@ -109,7 +109,7 @@ public class ModMailCategorySetupBean implements ModMailCategorySetup {
.delayedActionConfigList(delayedSteps)
.build();
} else {
throw new AbstractoRunTimeException("Category id does not conform.");
throw new InvalidCategoryException();
}
}
@@ -117,7 +117,7 @@ public class ModMailCategorySetupBean implements ModMailCategorySetup {
future.complete(result);
} catch (Exception e) {
log.error("Failed to handle post target step.", e);
future.completeExceptionally(e);
future.completeExceptionally(new SetupStepException(e));
}
};
interactiveService.createMessageWithResponse(messageText, aUserInAServer, channel.get(), parameter.getPreviousMessageId(), configAction, finalAction);

View File

@@ -0,0 +1 @@
<#include "setup_category_not_valid_exception_message">