Skip to content

Commit

Permalink
Merge pull request #92 from messagebird/Issue91_AddFieldToErrorReport
Browse files Browse the repository at this point in the history
added message field
  • Loading branch information
denizkilic authored Jan 19, 2020
2 parents 5bf57b4 + 768fe95 commit 3bb5b58
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions api/src/main/java/com/messagebird/objects/ErrorReport.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
package com.messagebird.objects;

import com.fasterxml.jackson.annotation.JsonInclude;
/**
* When MessageBird returns a 4xx, you will find a list of any error codes in your return dataset.
* you will receive a list of errors from the API in such case.
*
* Created by rvt on 1/5/15.
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ErrorReport {
private Integer code;
private String description;
private String parameter;
private String message;

public ErrorReport() {
}

public ErrorReport(Integer code, String description, String parameter) {
public ErrorReport(Integer code, String description, String parameter, String message) {
this.code = code;
this.description = description;
this.parameter = parameter;
this.message = message;
}

@Override
public String toString() {
return "ErrorReport{" +
"code=" + code +
", description='" + description + '\'' +
", parameter='" + parameter + '\'' +
'}';
String str = "ErrorReport{code=" + code;
if (message != null && !message.isEmpty()) {
str = str.concat(", message='" + message + "'");
} else {
str = str.concat(", description='" + description + "'");
str = str.concat(", parameter='" + parameter + "'");
}
str = str.concat("}");
return str;
}

/**
Expand All @@ -53,4 +61,11 @@ public String getParameter() {
return parameter;
}

/**
* message not null for only voice API response
* @return
*/
public String getMessage() {
return message;
}
}

0 comments on commit 3bb5b58

Please sign in to comment.