Skip to content

Commit a3d2488

Browse files
return a more descriptive error when parsing an API response fails
1 parent e56262e commit a3d2488

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

paystack/src/main/java/co/paystack/android/api/model/TransactionApiResponse.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public static TransactionApiResponse fromJsonString(String jsonString) {
3535
try {
3636
return new Gson().fromJson(jsonString, TransactionApiResponse.class);
3737
} catch (Exception e) {
38-
return TransactionApiResponse.unknownServerResponse();
38+
TransactionApiResponse t = new TransactionApiResponse();
39+
t.status = "0";
40+
t.message = e.getMessage();
41+
return t;
3942
}
4043
}
4144

0 commit comments

Comments
 (0)