View Javadoc
1   package fr.inrae.agroclim.indicators.exception;
2   
3   import java.io.Serializable;
4   import java.util.List;
5   
6   /**
7    * An exception with {@link ErrorMessage} to describe the error in the Indicators library to the user.
8    *
9    * @author Olivier Maury
10   */
11  public class IndicatorsException extends ErrorMessageException {
12      /**
13       * Path of .property resource.
14       */
15      private static final String BUNDLE_NAME = "fr.inrae.agroclim.indicators.resources.messages";
16  
17      /**
18       * UUID for Serializable.
19       */
20      private static final long serialVersionUID = 6030595237342400006L;
21  
22      /**
23       * Constructor.
24       *
25       * @param errorType Error type.
26       */
27      public IndicatorsException(final ErrorType errorType) {
28          super(new ErrorMessage(BUNDLE_NAME, errorType, List.of()));
29      }
30  
31      /**
32       * Constructor.
33       *
34       * @param errorType Error type.
35       * @param arguments Arguments for the message.
36       */
37      public IndicatorsException(final ErrorType errorType, final Serializable... arguments) {
38          super(new ErrorMessage(BUNDLE_NAME, errorType, List.of(arguments)));
39      }
40  
41      /**
42       * Constructor.
43       *
44       * @param errorType Error type.
45       * @param arguments Arguments for the message.
46       * @param  cause the cause (which is saved for later retrieval by the
47       *         {@link #getCause()} method).  (A {@code null} value is
48       *         permitted, and indicates that the cause is nonexistent or
49       *         unknown.)
50       */
51      public IndicatorsException(final ErrorType errorType, final Throwable cause, final Serializable... arguments) {
52          super(new ErrorMessage(BUNDLE_NAME, errorType, List.of(arguments)), cause);
53      }
54  }