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:
  • Method Details

    • getTypeAdaptingFailedMessage

      net.dv8tion.jda.api.components.MessageTopLevelComponent getTypeAdaptingFailedMessage(ErrorMessageFactory.ErrorContext context, io.github.kaktushose.proteus.conversion.ConversionResult.Failure<?> failure)
      Gets a MessageTopLevelComponent to send when type adapting of the user input failed.
      Parameters:
      context - the ErrorMessageFactory.ErrorContext
      failure - the ConversionResult.Failure
      Returns:
      a MessageTopLevelComponent to send when type adapting failed
    • getInsufficientPermissionsMessage

      net.dv8tion.jda.api.components.MessageTopLevelComponent getInsufficientPermissionsMessage(ErrorMessageFactory.ErrorContext context)
      Gets a MessageTopLevelComponent to send when a user is missing permissions.
      Parameters:
      context - the ErrorMessageFactory.ErrorContext
      Returns:
      a MessageTopLevelComponent to send when a user is missing permissions
    • getConstraintFailedMessage

      net.dv8tion.jda.api.components.MessageTopLevelComponent getConstraintFailedMessage(ErrorMessageFactory.ErrorContext context, String message)
      Gets a MessageTopLevelComponent to send when a parameter constraint fails.
      Parameters:
      context - the ErrorMessageFactory.ErrorContext
      Returns:
      a MessageTopLevelComponent to send when a parameter constraint fails
    • getInteractionExecutionFailedMessage

      net.dv8tion.jda.api.components.MessageTopLevelComponent getInteractionExecutionFailedMessage(ErrorMessageFactory.ErrorContext context, Throwable exception)
      Gets a MessageTopLevelComponent to send when the command execution failed.
      Parameters:
      context - the ErrorMessageFactory.ErrorContext
      exception - the Throwable that made the command execution fail
      Returns:
      a MessageTopLevelComponent to send when the command execution failed
    • getTimedOutComponentMessage

      net.dv8tion.jda.api.components.MessageTopLevelComponent getTimedOutComponentMessage(net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event)
      Gets a MessageTopLevelComponent to send when an incoming component interaction already timed out.
      Parameters:
      event - the GenericInteractionCreateEvent mo runtime was found for
      Returns:
      a MessageTopLevelComponent to send when an incoming component interaction already timed out