Interface ErrorMessageFactory
- All Known Implementing Classes:
DefaultErrorMessageFactory
public interface ErrorMessageFactory
Generic interface for factory classes that provide a
MessageTopLevelComponent that should be sent for common errors
that happen during an interaction execution, such as missing permissions or failing constraints.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceHolds the respectiveGenericInteractionCreateEventandInteractionDefinitionof an error. -
Method Summary
Modifier and TypeMethodDescriptionnet.dv8tion.jda.api.components.MessageTopLevelComponentgetConstraintFailedMessage(ErrorMessageFactory.ErrorContext context, String message) Gets aMessageTopLevelComponentto send when a parameter constraint fails.net.dv8tion.jda.api.components.MessageTopLevelComponentGets aMessageTopLevelComponentto send when a user is missing permissions.net.dv8tion.jda.api.components.MessageTopLevelComponentgetInteractionExecutionFailedMessage(ErrorMessageFactory.ErrorContext context, Throwable exception) Gets aMessageTopLevelComponentto send when the command execution failed.net.dv8tion.jda.api.components.MessageTopLevelComponentgetTimedOutComponentMessage(net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event) Gets aMessageTopLevelComponentto send when an incoming component interaction already timed out.net.dv8tion.jda.api.components.MessageTopLevelComponentgetTypeAdaptingFailedMessage(ErrorMessageFactory.ErrorContext context, io.github.kaktushose.proteus.conversion.ConversionResult.Failure<?> failure) Gets aMessageTopLevelComponentto send when type adapting of the user input failed.
-
Method Details
-
getTypeAdaptingFailedMessage
net.dv8tion.jda.api.components.MessageTopLevelComponent getTypeAdaptingFailedMessage(ErrorMessageFactory.ErrorContext context, io.github.kaktushose.proteus.conversion.ConversionResult.Failure<?> failure) Gets aMessageTopLevelComponentto send when type adapting of the user input failed.- Parameters:
context- theErrorMessageFactory.ErrorContextfailure- theConversionResult.Failure- Returns:
- a
MessageTopLevelComponentto send when type adapting failed
-
getInsufficientPermissionsMessage
net.dv8tion.jda.api.components.MessageTopLevelComponent getInsufficientPermissionsMessage(ErrorMessageFactory.ErrorContext context) Gets aMessageTopLevelComponentto send when a user is missing permissions.- Parameters:
context- theErrorMessageFactory.ErrorContext- Returns:
- a
MessageTopLevelComponentto send when a user is missing permissions
-
getConstraintFailedMessage
net.dv8tion.jda.api.components.MessageTopLevelComponent getConstraintFailedMessage(ErrorMessageFactory.ErrorContext context, String message) Gets aMessageTopLevelComponentto send when a parameter constraint fails.- Parameters:
context- theErrorMessageFactory.ErrorContext- Returns:
- a
MessageTopLevelComponentto send when a parameter constraint fails
-
getInteractionExecutionFailedMessage
net.dv8tion.jda.api.components.MessageTopLevelComponent getInteractionExecutionFailedMessage(ErrorMessageFactory.ErrorContext context, Throwable exception) Gets aMessageTopLevelComponentto send when the command execution failed.- Parameters:
context- theErrorMessageFactory.ErrorContextexception- theThrowablethat made the command execution fail- Returns:
- a
MessageTopLevelComponentto send when the command execution failed
-
getTimedOutComponentMessage
net.dv8tion.jda.api.components.MessageTopLevelComponent getTimedOutComponentMessage(net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event) Gets aMessageTopLevelComponentto send when an incoming component interaction already timed out.- Parameters:
event- theGenericInteractionCreateEventmo runtime was found for- Returns:
- a
MessageTopLevelComponentto send when an incoming component interaction already timed out
-