forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorStructure.java
More file actions
81 lines (67 loc) · 2.29 KB
/
Copy pathErrorStructure.java
File metadata and controls
81 lines (67 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.gooddata.gdc;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import static com.gooddata.Validate.notNull;
/**
* Error structure (for embedding).
* Deserialization only.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorStructure {
protected final String message;
protected final String[] parameters;
protected final String component;
protected final String errorClass;
protected final String errorCode;
protected final String errorId;
protected final String trace;
protected final String requestId;
@JsonCreator
protected ErrorStructure(@JsonProperty("errorClass") String errorClass, @JsonProperty("component") String component,
@JsonProperty("parameters") String[] parameters, @JsonProperty("message") String message,
@JsonProperty("errorCode") String errorCode, @JsonProperty("errorId") String errorId,
@JsonProperty("trace") String trace, @JsonProperty("requestId") String requestId) {
this.errorClass = notNull(errorClass, "errorClass");
this.component = notNull(component, "component");
this.parameters = notNull(parameters, "parameters");
this.message = notNull(message, "message");
this.errorCode = errorCode;
this.errorId = errorId;
this.trace = trace;
this.requestId = requestId;
}
public String getMessage() {
return message;
}
public String[] getParameters() {
return parameters;
}
public String getComponent() {
return component;
}
public String getErrorClass() {
return errorClass;
}
public String getErrorCode() {
return errorCode;
}
public String getErrorId() {
return errorId;
}
public String getTrace() {
return trace;
}
public String getRequestId() {
return requestId;
}
@JsonIgnore
public String getFormattedMessage() {
return message == null ? null : String.format(message, parameters);
}
@Override
public String toString() {
return getFormattedMessage();
}
}