Skip to content

Commit 8c79f4d

Browse files
committed
fix
1 parent bf612b0 commit 8c79f4d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636

3737
- name: Test
3838
run: ./gradlew test
39+
env:
40+
TEST_SQUARE_TOKEN: ${{ secrets.TEST_SQUARE_TOKEN }}
3941
publish:
4042
needs: [ compile, test ]
4143
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')

src/main/java/com/squareup/square/core/SquareApiException.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
*/
44
package com.squareup.square.core;
55

6+
import java.util.ArrayList;
7+
import java.util.HashMap;
8+
import java.util.List;
9+
import java.util.Map;
10+
import java.util.Optional;
11+
612
import com.fasterxml.jackson.core.JsonProcessingException;
713
import com.fasterxml.jackson.databind.JsonNode;
814
import com.squareup.square.types.Error;
915
import com.squareup.square.types.ErrorCategory;
1016
import com.squareup.square.types.ErrorCode;
11-
import java.util.ArrayList;
12-
import java.util.List;
13-
import java.util.Map;
14-
import java.util.HashMap;
15-
import java.util.Optional;
17+
1618
import okhttp3.Response;
1719

1820
/**
@@ -39,7 +41,7 @@ public class SquareApiException extends SquareException {
3941
*/
4042
private final Object body;
4143

42-
private final Map<String, List<String>> headers;
44+
private final Map<String, List<String>> headers = new HashMap<>();
4345

4446
private final List<Error> errors;
4547

@@ -54,7 +56,7 @@ public SquareApiException(String message, int statusCode, Object body, Response
5456
super(message);
5557
this.statusCode = statusCode;
5658
this.body = body;
57-
this.headers = new HashMap<>();
59+
this.errors = parseErrors(body);
5860
rawResponse.headers().forEach(header -> {
5961
String key = header.component1();
6062
String value = header.component2();

0 commit comments

Comments
 (0)