Skip to content

Commit

Permalink
Ignore unknown message types
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment committed Jun 26, 2019
1 parent 508e1fa commit 07ac193
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ protected Long handleInternally(JSONObject content)
EventCache.LOG.debug("Received a message for a user that JDA does not currently have cached");
return null;
}
case EntityBuilder.UNKNOWN_MESSAGE_TYPE:
{
WebSocketClient.LOG.debug("Ignoring message with unknown type: {}", content);
return null;
}
default:
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected Long handleInternally(JSONObject content)
case DEFAULT:
return handleMessage(content);
default:
WebSocketClient.LOG.debug("JDA received a message of unknown type. Type: {} JSON: {}", type, content);
WebSocketClient.LOG.debug("JDA received a message update for an unexpected message type. Type: {} JSON: {}", type, content);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ protected void handleResponse(Response response, Request<List<Message>> request)
{
LOG.warn("Encountered an exception in MessagePagination", e);
}
catch (IllegalArgumentException e)
{
if (EntityBuilder.UNKNOWN_MESSAGE_TYPE.equals(e.getMessage()))
LOG.warn("Skipping unknown message type during pagination", e);
else
LOG.warn("Unexpected issue trying to parse message during pagination", e);
}
}

request.onSuccess(messages);
Expand Down

0 comments on commit 07ac193

Please sign in to comment.