Skip to content

Commit b51663f

Browse files
authored
Add API message error to response exception (#483)
1 parent b1ed9e7 commit b51663f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

AndroidSDKCore/src/main/java/com/leanplum/internal/RequestSender.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,9 @@ public void sendRequests() {
153153
sendRequests();
154154
}
155155
} else {
156-
Exception errorException = new Exception("HTTP error " + statusCode);
157-
String errorMessage = errorException.getMessage();
156+
String errorMessage = "HTTP error " + statusCode;
158157
if (responseBody != null) {
159-
errorMessage += " " + responseBody.toString();
158+
errorMessage += ": " + responseBody.toString();
160159
}
161160
Log.i(errorMessage);
162161

@@ -166,6 +165,8 @@ public void sendRequests() {
166165
&& !(statusCode >= 500 && statusCode <= 599)) {
167166
batchFactory.deleteFinishedBatch(batch);
168167
}
168+
169+
Exception errorException = new Exception(errorMessage);
169170
invokeCallbacksWithError(errorException);
170171
}
171172
} catch (JSONException e) {

0 commit comments

Comments
 (0)