1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.restapi.v1.errors;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import jakarta.ws.rs.core.Response.Status;
25
26
27
28
29
30
31
32
33 public class MCRRestAPIException extends Exception {
34
35 private static final long serialVersionUID = 1L;
36
37 private List<MCRRestAPIError> errors = new ArrayList<>();
38
39
40 private Status status = Status.INTERNAL_SERVER_ERROR;
41
42 public MCRRestAPIException(Status status, MCRRestAPIError error) {
43 this.status = status;
44 errors.add(error);
45 }
46
47 public MCRRestAPIException(Status status, List<MCRRestAPIError> errors) {
48 this.status = status;
49 this.errors.addAll(errors);
50 }
51
52 public List<MCRRestAPIError> getErrors() {
53 return errors;
54 }
55
56 public Status getStatus() {
57 return status;
58 }
59
60 public void setStatus(Status status) {
61 this.status = status;
62 }
63 }