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 TypeMethodDescriptiongetConstraintFailedMessage(ErrorMessageFactory.ErrorContext context, String message) Gets aMessageTopLevelComponentto send when a parameter constraint fails.Gets aMessageTopLevelComponentto send when a user is missing permissions.getInteractionExecutionFailedMessage(ErrorMessageFactory.ErrorContext context, Throwable exception) Gets aMessageTopLevelComponentto send when the command execution failed.Gets aMessageTopLevelComponentto send when an incoming component interaction already timed out.getTypeAdaptingFailedMessage(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
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
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
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
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
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
-