Skip to content

Commit

Permalink
printStackTrace on exception in DiscordKeyboards#createKeyboardModel
Browse files Browse the repository at this point in the history
  • Loading branch information
bivashy committed Jul 26, 2023
1 parent 47162a1 commit 92dfebc
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ public Map<String, String> getRawJsonKeyboards() {

@Override
public Keyboard createKeyboardModel(String rawJson) {
DataObject dataObject = DataObject.fromJson(rawJson);
DataArray rowsDataArray = dataObject.getArray("rows");
List<ActionRow> actionRows = new ArrayList<>();
for (int i = 0; i < rowsDataArray.length(); i++)
actionRows.add(ActionRow.fromData(rowsDataArray.getObject(i)));
return new DiscordKeyboard(actionRows);
try {
DataObject dataObject = DataObject.fromJson(rawJson);
DataArray rowsDataArray = dataObject.getArray("rows");
List<ActionRow> actionRows = new ArrayList<>();
for (int i = 0; i < rowsDataArray.length(); i++)
actionRows.add(ActionRow.fromData(rowsDataArray.getObject(i)));
return new DiscordKeyboard(actionRows);
} catch(Throwable t) {
t.printStackTrace();
return new DiscordKeyboard();
}
}
}

0 comments on commit 92dfebc

Please sign in to comment.