Various things

This commit is contained in:
Anuken
2019-08-11 18:01:32 -04:00
parent 0770574f17
commit 85fd2ad804

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.net; package io.anuke.mindustry.net;
import io.anuke.arc.*; import io.anuke.arc.*;
import io.anuke.arc.Net.*;
import io.anuke.arc.collection.*; import io.anuke.arc.collection.*;
import io.anuke.arc.function.*; import io.anuke.arc.function.*;
import io.anuke.arc.util.*; import io.anuke.arc.util.*;
@@ -103,7 +104,7 @@ public class CrashSender{
Log.info("Sending crash report."); Log.info("Sending crash report.");
//post to crash report URL //post to crash report URL
Core.net.httpPost(Vars.crashReportURL, value.toJson(OutputType.json), r -> { httpPost(Vars.crashReportURL, value.toJson(OutputType.json), r -> {
Log.info("Crash sent successfully."); Log.info("Crash sent successfully.");
sent[0] = true; sent[0] = true;
System.exit(1); System.exit(1);
@@ -126,6 +127,10 @@ public class CrashSender{
} }
} }
private static void httpPost(String url, String content, Consumer<HttpResponse> success, Consumer<Throwable> failure){
new NetJavaImpl().http(new HttpRequest().method(HttpMethod.POST).content(content).url(url), success, failure);
}
private static String parseException(Throwable e){ private static String parseException(Throwable e){
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);