mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-11 18:39:16 +07:00
Exception parsing cleanup
This commit is contained in:
parent
fa2df57021
commit
31708b9af7
Binary file not shown.
@ -25,6 +25,9 @@ public class SectorPresets implements ContentList{
|
||||
alwaysUnlocked = true;
|
||||
conditionWave = 5;
|
||||
launchPeriod = 5;
|
||||
rules = r -> {
|
||||
r.winWave = 30;
|
||||
};
|
||||
}};
|
||||
|
||||
saltFlats = new SectorPreset("saltFlats", starter, 101){{
|
||||
|
@ -373,7 +373,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
cont.add((text.startsWith("$") ? Core.bundle.get(text.substring(1)) : text) + (message == null ? "" : "\n[lightgray](" + message + ")")).colspan(2).wrap().growX().center().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
|
||||
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(Strings.parseException(exc, true)).color(Color.lightGray).left()), true);
|
||||
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(Strings.neatError(exc)).color(Color.lightGray).left()));
|
||||
|
||||
cont.button("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
|
||||
cont.button("$ok", this::hide).size(110, 50).fillX().left();
|
||||
|
@ -230,6 +230,7 @@ public class World{
|
||||
loadGenerator(size, size, tiles -> {
|
||||
if(sector.preset != null){
|
||||
sector.preset.generator.generate(tiles);
|
||||
sector.preset.rules.get(state.rules); //apply extra rules
|
||||
}else{
|
||||
sector.planet.generator.generate(tiles, sector);
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ public class ContentParser{
|
||||
if(t.getMessage() != null && t instanceof JsonParseException){
|
||||
builder.append("[accent][[JsonParse][] ").append(":\n").append(t.getMessage());
|
||||
}else if(t instanceof NullPointerException){
|
||||
builder.append(Strings.parseException(t, true));
|
||||
builder.append(Strings.neatError(t));
|
||||
}else{
|
||||
Seq<Throwable> causes = Strings.getCauses(t);
|
||||
for(Throwable e : causes){
|
||||
|
@ -24,7 +24,7 @@ public class CrashSender{
|
||||
|
||||
public static void log(Throwable exception){
|
||||
try{
|
||||
Core.settings.getDataDirectory().child("crashes").child("crash_" + System.currentTimeMillis() + ".txt").writeString(Strings.parseException(exception, true));
|
||||
Core.settings.getDataDirectory().child("crashes").child("crash_" + System.currentTimeMillis() + ".txt").writeString(Strings.neatError(exception));
|
||||
}catch(Throwable ignored){
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class Net{
|
||||
error = Core.bundle.get("error.io");
|
||||
}else if(error.equals("mismatch")){
|
||||
error = Core.bundle.get("error.mismatch");
|
||||
}else if(error.contains("port out of range") || error.contains("invalid argument") || (error.contains("invalid") && error.contains("address")) || Strings.parseException(e, true).contains("address associated")){
|
||||
}else if(error.contains("port out of range") || error.contains("invalid argument") || (error.contains("invalid") && error.contains("address")) || Strings.neatError(e).contains("address associated")){
|
||||
error = Core.bundle.get("error.invalidaddress");
|
||||
}else if(error.contains("connection refused") || error.contains("route to host") || type.contains("unknownhost")){
|
||||
error = Core.bundle.get("error.unreachable");
|
||||
|
@ -9,7 +9,6 @@ import arc.func.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.async.*;
|
||||
import arc.util.serialization.*;
|
||||
import club.minnced.discord.rpc.*;
|
||||
import com.codedisaster.steamworks.*;
|
||||
@ -63,7 +62,8 @@ public class DesktopLauncher extends ClientLauncher{
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown));
|
||||
}catch(Throwable t){
|
||||
useDiscord = false;
|
||||
Log.err("Failed to initialize discord.", t);
|
||||
Log.err("Failed to initialize discord. Enable debug logging for details.");
|
||||
Log.debug("Discord init error: \n@\n", Strings.getStackTrace(t));
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class DesktopLauncher extends ClientLauncher{
|
||||
loadError = true;
|
||||
Log.err(e);
|
||||
try(OutputStream s = new FileOutputStream(new File("steam-error-log-" + System.nanoTime() + ".txt"))){
|
||||
String log = Strings.parseException(e, true);
|
||||
String log = Strings.neatError(e);
|
||||
s.write(log.getBytes());
|
||||
}catch(Exception e2){
|
||||
Log.err(e2);
|
||||
|
@ -542,7 +542,7 @@ public class ApplicationTests{
|
||||
|
||||
@Test
|
||||
void allBlockTest(){
|
||||
Tiles tiles = world.resize(256*2 + 20, 10);
|
||||
Tiles tiles = world.resize(256*3 + 20, 10);
|
||||
|
||||
world.beginMapLoad();
|
||||
for(int x = 0; x < tiles.width; x++){
|
||||
|
@ -60,12 +60,16 @@ public class SectorTests{
|
||||
Seq<SpawnGroup> spawns = state.rules.spawns;
|
||||
|
||||
int bossWave = 0;
|
||||
outer:
|
||||
for(int i = 1; i <= 1000; i++){
|
||||
for(SpawnGroup spawn : spawns){
|
||||
if(spawn.effect == StatusEffects.boss && spawn.getUnitsSpawned(i) > 0){
|
||||
bossWave = i;
|
||||
break outer;
|
||||
if(state.rules.winWave > 0){
|
||||
bossWave = state.rules.winWave;
|
||||
}else{
|
||||
outer:
|
||||
for(int i = 1; i <= 1000; i++){
|
||||
for(SpawnGroup spawn : spawns){
|
||||
if(spawn.effect == StatusEffects.boss && spawn.getUnitsSpawned(i) > 0){
|
||||
bossWave = i;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user