Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}