View Javadoc
1   package de.dlr.shepard.common.exceptions;
2   
3   import jakarta.ws.rs.core.Response.Status;
4   import java.io.Serial;
5   
6   /**
7    * InvalidBodyException implements an exception. This exception should be thrown
8    * if a value in the JSON Request Body doesn't fulfill the necessary constraints
9    * of an attribute. When a InvalidBodyException is thrown a Bad Request (status
10   * code 400) does get sent with a message informing the client about the
11   * specific error.
12   **/
13  public class InvalidBodyException extends ShepardException {
14  
15    @Serial
16    private static final long serialVersionUID = 8918170154141864994L;
17  
18    private static final Status status = Status.BAD_REQUEST;
19  
20    public InvalidBodyException() {
21      super("Some of the values provided in the JSON Body are incorrect", status);
22    }
23  
24    public InvalidBodyException(String message) {
25      super(message, status);
26    }
27  
28    public InvalidBodyException(String format, Object... args) {
29      super(format.formatted(args), status);
30    }
31  }