View Javadoc
1   package dev.sympho.modular_commands.api.command.parameter.parse;
2   
3   import org.checkerframework.checker.nullness.util.NullnessUtil;
4   
5   import dev.sympho.modular_commands.api.exception.CommandException;
6   
7   /**
8    * Exception thrown when an argument cannot be parsed due to being invalid.
9    *
10   * @version 1.0
11   * @since 1.0
12   */
13  public class InvalidArgumentException extends CommandException {
14  
15      private static final long serialVersionUID = -6587869519938247026L;
16  
17      /**
18       * Constructs a new exception.
19       *
20       * @param message A message detailing why the argument is invalid.
21       */
22      public InvalidArgumentException( final String message ) {
23  
24          super( message );
25  
26      }
27  
28      /**
29       * Constructs a new exception.
30       *
31       * @param message A message detailing why the argument is invalid.
32       * @param cause The exception that caused the value to be invalid.
33       */
34      public InvalidArgumentException( final String message, final Throwable cause ) {
35  
36          super( message, cause );
37  
38      }
39  
40      // Just to narrow the return to NonNull.
41      @Override
42      public String getMessage() {
43          return NullnessUtil.castNonNull( super.getMessage() );
44      }
45      
46  }