http status codes being ignored
JavaCord will attempt to parse Discord's repsonse on certain actions (e.g. sendMessage()) without checking the http response code. This results in HTML being parsed as JSON, and an exception being thrown. Attached is a stacktrace of when the API returned an HTTP 502, but JavaCord tried parsing the response as JSON anyway.

https://hastebin.com/zodofazefi.php

diff --git a/javacord-core/src/main/java/org/javacord/core/util/rest/RestRequestResult.java b/javacord-core/src/main/java/org/javacord/core/util/rest/RestRequestResult.java
index 515aa667..a983cef7 100644
--- a/javacord-core/src/main/java/org/javacord/core/util/rest/RestRequestResult.java
+++ b/javacord-core/src/main/java/org/javacord/core/util/rest/RestRequestResult.java
@@ -1,10 +1,13 @@
 package org.javacord.core.util.rest;
 
+import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.NullNode;
 import okhttp3.Response;
 import okhttp3.ResponseBody;
+import org.apache.logging.log4j.Logger;
+import org.javacord.core.util.logging.LoggerUtil;
 
 import java.io.IOException;
 import java.util.Optional;
@@ -14,6 +17,11 @@ import java.util.Optional;
  */
 public class RestRequestResult {
 
+    /**
+     * The logger of this class.
+     */
+    private static final Logger logger = LoggerUtil.getLogger(RestRequestResult.class);
+
     private final RestRequest<?> request;
     private final Response response;
     private final ResponseBody body;
@@ -37,7 +45,14 @@ public class RestRequestResult {
         } else {
             stringBody = body.string();
             ObjectMapper mapper = request.getApi().getObjectMapper();
-            JsonNode jsonBody = mapper.readTree(stringBody);
+            JsonNode jsonBody;
+            try {
+                jsonBody = mapper.readTree(stringBody);
+            } catch (JsonParseException e) {
+                // This can happen if Discord sends garbage (see https://github.com/Javacord/Javacord/issues/526)
+                logger.debug("Failed to parse json response", e);
+                jsonBody = null;
+            }
             this.jsonBody = jsonBody == null ? NullNode.getInstance() : jsonBody;
         }
     }
@@ -80,7 +95,7 @@ public class RestRequestResult {
 
     /**
      * Gets the json body of the response.
-     * Returns a {@link NullNode} if the response had no body.
+     * Returns a {@link NullNode} if the response had no body or the body is not in a valid json format.
      *
      * @return The json body of the response.
      */
['javacord-core/src/main/java/org/javacord/core/util/rest/RestRequestResult.java']