11package com .messagebird .objects ;
22
3+ import com .fasterxml .jackson .annotation .JsonInclude ;
34/**
45 * When MessageBird returns a 4xx, you will find a list of any error codes in your return dataset.
56 * you will receive a list of errors from the API in such case.
67 *
78 * Created by rvt on 1/5/15.
89 */
10+ @ JsonInclude (JsonInclude .Include .NON_EMPTY )
911public class ErrorReport {
1012 private Integer code ;
1113 private String description ;
1214 private String parameter ;
15+ private String message ;
1316
1417 public ErrorReport () {
1518 }
1619
17- public ErrorReport (Integer code , String description , String parameter ) {
20+ public ErrorReport (Integer code , String description , String parameter , String message ) {
1821 this .code = code ;
1922 this .description = description ;
2023 this .parameter = parameter ;
24+ this .message = message ;
2125 }
2226
2327 @ Override
2428 public String toString () {
25- return "ErrorReport{" +
26- "code=" + code +
27- ", description='" + description + '\'' +
28- ", parameter='" + parameter + '\'' +
29- '}' ;
29+ String str = "ErrorReport{code=" + code ;
30+ if (message != null && !message .isEmpty ()) {
31+ str = str .concat (", message='" + message + "'" );
32+ } else {
33+ str = str .concat (", description='" + description + "'" );
34+ str = str .concat (", parameter='" + parameter + "'" );
35+ }
36+ str = str .concat ("}" );
37+ return str ;
3038 }
3139
3240 /**
@@ -53,4 +61,11 @@ public String getParameter() {
5361 return parameter ;
5462 }
5563
64+ /**
65+ * message not null for only voice API response
66+ * @return
67+ */
68+ public String getMessage () {
69+ return message ;
70+ }
5671}
0 commit comments