diff --git a/pom.xml b/pom.xml
index 46696c3..61bca45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
com.taboola
backstage-api-java-client
- 1.1.2
+ 1.1.3
${project.groupId}:${project.artifactId}
Backstage API Java Client
diff --git a/src/main/java/com/taboola/backstage/Backstage.java b/src/main/java/com/taboola/backstage/Backstage.java
index 042aa8d..29f7828 100644
--- a/src/main/java/com/taboola/backstage/Backstage.java
+++ b/src/main/java/com/taboola/backstage/Backstage.java
@@ -181,7 +181,7 @@ public static class BackstageBuilder {
private static final String DEFAULT_BACKSTAGE_HOST = "https://backstage.taboola.com/backstage/";
private static final String DEFAULT_AUTH_BACKSTAGE_HOST = "https://authentication.taboola.com/authentication/";
private static final String DEFAULT_USER_AGENT = "Taboola Java Client";
- private static final String VERSION = "1.1.2";
+ private static final String VERSION = "1.1.3";
private static final SerializationConfig DEFAULT_SERIALIZATION_CONFIG = new SerializationConfig();
private String baseUrl;
diff --git a/src/main/java/com/taboola/backstage/exceptions/BackstageAPIException.java b/src/main/java/com/taboola/backstage/exceptions/BackstageAPIException.java
index d8fa9d4..6fbc20b 100644
--- a/src/main/java/com/taboola/backstage/exceptions/BackstageAPIException.java
+++ b/src/main/java/com/taboola/backstage/exceptions/BackstageAPIException.java
@@ -35,7 +35,7 @@ private static String parseError(APIError error) {
return "";
}
- return String.format(". Response payload status [%s], message [%s], offending field [%s], message code [%s]", error.getHttpStatus(), error.getMessage(), error.getOffendingField(), error.getMessageCode());
+ return String.format(". Response payload status [%s], message [%s], offending field [%s], message code [%s], message code template [%s], template parameters [%s] ", error.getHttpStatus(), error.getMessage(), error.getOffendingField(), error.getMessageCode(), error.getMessageCodeEnglishTemplate(), error.getTemplateParameters());
}
public APIError getError() {
diff --git a/src/main/java/com/taboola/backstage/model/APIError.java b/src/main/java/com/taboola/backstage/model/APIError.java
index d7e9b44..db41d20 100644
--- a/src/main/java/com/taboola/backstage/model/APIError.java
+++ b/src/main/java/com/taboola/backstage/model/APIError.java
@@ -1,5 +1,8 @@
package com.taboola.backstage.model;
+import java.util.Collection;
+import java.util.List;
+
/**
* Created by vladi
* Date: 10/12/2017
@@ -14,6 +17,8 @@ public class APIError {
private String message;
private String offendingField;
private String messageCode;
+ private String messageCodeEnglishTemplate;
+ private List templateParameters;
public APIError() {
//for jackson
@@ -25,10 +30,16 @@ public APIError(String message, int httpStatus) {
}
public APIError(String message, int httpStatus, String offendingField, String messageCode) {
+ this(message, httpStatus, offendingField, messageCode, null, null);
+ }
+
+ public APIError(String message, int httpStatus, String offendingField, String messageCode, String messageCodeEnglishTemplate, List templateParameters) {
this.message = message;
this.httpStatus = httpStatus;
this.offendingField = offendingField;
this.messageCode = messageCode;
+ this.messageCodeEnglishTemplate = messageCodeEnglishTemplate;
+ this.templateParameters = templateParameters;
}
public int getHttpStatus() {
@@ -63,6 +74,22 @@ public void setMessageCode(String messageCode) {
this.messageCode = messageCode;
}
+ public String getMessageCodeEnglishTemplate() {
+ return messageCodeEnglishTemplate;
+ }
+
+ public void setMessageCodeEnglishTemplate(String messageCodeEnglishTemplate) {
+ this.messageCodeEnglishTemplate = messageCodeEnglishTemplate;
+ }
+
+ public Collection getTemplateParameters() {
+ return templateParameters;
+ }
+
+ public void setTemplateParameters(List templateParameters) {
+ this.templateParameters = templateParameters;
+ }
+
@Override
public String toString() {
return "APIError{" +
@@ -70,6 +97,9 @@ public String toString() {
", message='" + message + '\'' +
", offendingField='" + offendingField + '\'' +
", messageCode='" + messageCode + '\'' +
+ ", messageCodeEnglishTemplate='" + messageCodeEnglishTemplate + '\'' +
+ ", templateParameters=" + templateParameters +
'}';
}
+
}
diff --git a/src/test/java/com/taboola/backstage/internal/factories/BackstageAPIExceptionFactoryTest.java b/src/test/java/com/taboola/backstage/internal/factories/BackstageAPIExceptionFactoryTest.java
index 593ace6..87d622c 100644
--- a/src/test/java/com/taboola/backstage/internal/factories/BackstageAPIExceptionFactoryTest.java
+++ b/src/test/java/com/taboola/backstage/internal/factories/BackstageAPIExceptionFactoryTest.java
@@ -35,6 +35,6 @@ public void testParseError_whenErrorMsgContainsPercentSign_expectingValidFormatF
apiError = testInstance.normalizeError(apiError);
BackstageAPIException ex = new BackstageAPIRequestException(400, apiError);
logger.info(ex);
- assertEquals("Failed to perform API call with response code [400]. Response payload status [400], message [Cpc boost value must be between -99% and 100%], offending field [null], message code [null]", ex.getMessage());
+ assertEquals("Failed to perform API call with response code [400]. Response payload status [400], message [Cpc boost value must be between -99% and 100%], offending field [null], message code [null], message code template [null], template parameters [null] ", ex.getMessage());
}
}