Updated to new Arc net
This commit is contained in:
@@ -147,26 +147,18 @@ public class CrashSender{
|
||||
ex(() -> value.addChild("javaVersion", new JsonValue(System.getProperty("java.version"))));
|
||||
ex(() -> value.addChild("javaArch", new JsonValue(System.getProperty("sun.arch.data.model"))));
|
||||
|
||||
boolean[] sent = {false};
|
||||
|
||||
Log.info("Sending crash report.");
|
||||
|
||||
//post to crash report URL, exit code indicates send success
|
||||
httpPost(Vars.crashReportURL, value.toJson(OutputType.json), r -> {
|
||||
new arc.Net().http(new HttpRequest().block(true).method(HttpMethod.POST).content(value.toJson(OutputType.json)).url(Vars.crashReportURL), r -> {
|
||||
Log.info("Crash sent successfully.");
|
||||
sent[0] = true;
|
||||
System.exit(1);
|
||||
}, t -> {
|
||||
t.printStackTrace();
|
||||
sent[0] = true;
|
||||
Log.info("Crash report not sent.");
|
||||
System.exit(-1);
|
||||
});
|
||||
|
||||
//sleep until report is sent
|
||||
try{
|
||||
while(!sent[0]){
|
||||
Thread.sleep(30);
|
||||
}
|
||||
}catch(InterruptedException ignored){}
|
||||
ret();
|
||||
}catch(Throwable death){
|
||||
death.printStackTrace();
|
||||
}
|
||||
@@ -178,10 +170,6 @@ public class CrashSender{
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
private static void httpPost(String url, String content, Cons<HttpResponse> success, Cons<Throwable> failure){
|
||||
new NetJavaImpl().http(new HttpRequest().method(HttpMethod.POST).content(content).url(url), success, failure);
|
||||
}
|
||||
|
||||
private static String parseException(Throwable e){
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
|
||||
Reference in New Issue
Block a user