Better error handling on Steam

This commit is contained in:
Anuken
2020-09-22 13:12:21 -04:00
parent 5895e2f23c
commit 3a466475fd
4 changed files with 23 additions and 18 deletions
+14 -2
View File
@@ -1,10 +1,11 @@
package mindustry.net;
import arc.*;
import arc.struct.*;
import arc.func.*;
import arc.util.*;
import arc.net.*;
import arc.struct.*;
import arc.util.ArcAnnotate.*;
import arc.util.*;
import arc.util.pooling.*;
import mindustry.gen.*;
import mindustry.net.Packets.*;
@@ -13,6 +14,7 @@ import net.jpountz.lz4.*;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import static mindustry.Vars.*;
@@ -36,6 +38,16 @@ public class Net{
this.provider = provider;
}
public void handleException(Throwable e){
if(e instanceof ArcNetException){
Core.app.post(() -> showError(new IOException("mismatch")));
}else if(e instanceof ClosedChannelException){
Core.app.post(() -> showError(new IOException("alreadyconnected")));
}else{
Core.app.post(() -> showError(e));
}
}
/** Display a network error. Call on the graphics thread. */
public void showError(Throwable e){