Try provide github error details

This commit is contained in:
libraryaddict 2020-06-11 11:30:53 +12:00
parent a9ce0b0ee7
commit 9eebcc7afd
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -8,6 +8,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.LibsPremium; import me.libraryaddict.disguise.utilities.LibsPremium;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -127,6 +128,20 @@ public class LDGithub {
gitData = new Gson().fromJson(json, GithubData.class); gitData = new Gson().fromJson(json, GithubData.class);
} }
catch (IOException ex) {
try (InputStream error = con.getErrorStream()) {
String line = new BufferedReader(new InputStreamReader(error, StandardCharsets.UTF_8)).lines()
.collect(Collectors.joining("\n"));
DisguiseUtilities.getLogger().severe("Error with Github! " + line);
}
catch (Exception ex1) {
DisguiseUtilities.getLogger().severe("Error when trying to read error stream! Inception!");
ex1.printStackTrace();
}
throw ex;
}
String download = null; String download = null;