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
+3 -13
View File
@@ -61,7 +61,7 @@ public class ArcNetProvider implements NetProvider{
try{
net.handleClientReceived(object);
}catch(Throwable e){
handleException(e);
net.handleException(e);
}
});
@@ -144,14 +144,14 @@ public class ArcNetProvider implements NetProvider{
try{
client.run();
}catch(Exception e){
if(!(e instanceof ClosedSelectorException)) handleException(e);
if(!(e instanceof ClosedSelectorException)) net.handleException(e);
}
});
client.connect(5000, ip, port, port);
success.run();
}catch(Exception e){
handleException(e);
net.handleException(e);
}
});
}
@@ -269,16 +269,6 @@ public class ArcNetProvider implements NetProvider{
return null;
}
void handleException(Throwable e){
if(e instanceof ArcNetException){
Core.app.post(() -> net.showError(new IOException("mismatch")));
}else if(e instanceof ClosedChannelException){
Core.app.post(() -> net.showError(new IOException("alreadyconnected")));
}else{
Core.app.post(() -> net.showError(e));
}
}
class ArcConnection extends NetConnection{
public final Connection connection;