View Javadoc
1   package org.oxerr.viagogo.client.rescu.resource;
2   
3   import java.util.List;
4   import java.util.Map;
5   import java.util.Objects;
6   
7   import org.apache.commons.lang3.builder.ToStringBuilder;
8   
9   import com.fasterxml.jackson.annotation.JsonProperty;
10  
11  import si.mazi.rescu.HttpStatusExceptionSupport;
12  
13  public class ViagogoException extends HttpStatusExceptionSupport {
14  
15  	private static final long serialVersionUID = 2023020201L;
16  
17  	private final String type;
18  
19  	private final String title;
20  
21  	private final Integer status;
22  
23  	private final String traceId;
24  
25  	private final String code;
26  
27  	private final Map<String, List<String>> errors;
28  
29  	public ViagogoException(
30  		@JsonProperty("type") String type,
31  		@JsonProperty("title") String title,
32  		@JsonProperty("status") int status,
33  		@JsonProperty("traceId") String traceId,
34  		@JsonProperty("code") String code,
35  		@JsonProperty("message") String message,
36  		@JsonProperty("errors") Map<String, List<String>> errors
37  	) {
38  		super(Objects.toString(title, message));
39  		this.type = type;
40  		this.title = title;
41  		this.status = status;
42  		this.traceId = traceId;
43  		this.code = code;
44  		this.errors = errors;
45  	}
46  
47  	public String getType() {
48  		return type;
49  	}
50  
51  
52  	public String getTitle() {
53  		return title;
54  	}
55  
56  
57  	public Integer getStatus() {
58  		return status;
59  	}
60  
61  
62  	public String getTraceId() {
63  		return traceId;
64  	}
65  
66  	public String getCode() {
67  		return code;
68  	}
69  
70  	public Map<String, List<String>> getErrors() {
71  		return errors;
72  	}
73  
74  	@Override
75  	public String toString() {
76  		return new ToStringBuilder(this)
77  			.append("type", type)
78  			.append("title", title)
79  			.append("status", status)
80  			.append("traceId", traceId)
81  			.append("code", code)
82  			.append("errors", errors)
83  			.build();
84  	}
85  
86  }