Skip to content

Commit

Permalink
Merge pull request #1992 from moneymanagerex/google
Browse files Browse the repository at this point in the history
Handle IllegalArgumentException from TransactionStatuses.get
  • Loading branch information
guanlisheng authored Dec 22, 2024
2 parents f6ffa0f + 95c7a88 commit 30b0e51
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ public static TransactionStatuses from(String statusName) {
}

public static TransactionStatuses get(String code) {
if (code.equals("N")) {
return TransactionStatuses.NONE;
}
for (TransactionStatuses value : TransactionStatuses.values()) {
String currentCode = value.getCode();
if (currentCode.equals(code)) {
return value;
}
}
throw new IllegalArgumentException("no transaction status found for " + code);

// fallback to NONE for any unrecognized string
return TransactionStatuses.NONE;
}

TransactionStatuses(String code) {
Expand Down

0 comments on commit 30b0e51

Please sign in to comment.