mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-09 15:27:45 +07:00
Exception parsing cleanup
This commit is contained in:
Binary file not shown.
@ -25,6 +25,9 @@ public class SectorPresets implements ContentList{
|
|||||||
alwaysUnlocked = true;
|
alwaysUnlocked = true;
|
||||||
conditionWave = 5;
|
conditionWave = 5;
|
||||||
launchPeriod = 5;
|
launchPeriod = 5;
|
||||||
|
rules = r -> {
|
||||||
|
r.winWave = 30;
|
||||||
|
};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
saltFlats = new SectorPreset("saltFlats", starter, 101){{
|
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.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();
|
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("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
|
||||||
cont.button("$ok", this::hide).size(110, 50).fillX().left();
|
cont.button("$ok", this::hide).size(110, 50).fillX().left();
|
||||||
|
@ -230,6 +230,7 @@ public class World{
|
|||||||
loadGenerator(size, size, tiles -> {
|
loadGenerator(size, size, tiles -> {
|
||||||
if(sector.preset != null){
|
if(sector.preset != null){
|
||||||
sector.preset.generator.generate(tiles);
|
sector.preset.generator.generate(tiles);
|
||||||
|
sector.preset.rules.get(state.rules); //apply extra rules
|
||||||
}else{
|
}else{
|
||||||
sector.planet.generator.generate(tiles, sector);
|
sector.planet.generator.generate(tiles, sector);
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ public class ContentParser{
|
|||||||
if(t.getMessage() != null && t instanceof JsonParseException){
|
if(t.getMessage() != null && t instanceof JsonParseException){
|
||||||
builder.append("[accent][[JsonParse][] ").append(":\n").append(t.getMessage());
|
builder.append("[accent][[JsonParse][] ").append(":\n").append(t.getMessage());
|
||||||
}else if(t instanceof NullPointerException){
|
}else if(t instanceof NullPointerException){
|
||||||
builder.append(Strings.parseException(t, true));
|
builder.append(Strings.neatError(t));
|
||||||
}else{
|
}else{
|
||||||
Seq<Throwable> causes = Strings.getCauses(t);
|
Seq<Throwable> causes = Strings.getCauses(t);
|
||||||
for(Throwable e : causes){
|
for(Throwable e : causes){
|
||||||
|
@ -24,7 +24,7 @@ public class CrashSender{
|
|||||||
|
|
||||||
public static void log(Throwable exception){
|
public static void log(Throwable exception){
|
||||||
try{
|
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){
|
}catch(Throwable ignored){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class Net{
|
|||||||
error = Core.bundle.get("error.io");
|
error = Core.bundle.get("error.io");
|
||||||
}else if(error.equals("mismatch")){
|
}else if(error.equals("mismatch")){
|
||||||
error = Core.bundle.get("error.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");
|
error = Core.bundle.get("error.invalidaddress");
|
||||||
}else if(error.contains("connection refused") || error.contains("route to host") || type.contains("unknownhost")){
|
}else if(error.contains("connection refused") || error.contains("route to host") || type.contains("unknownhost")){
|
||||||
error = Core.bundle.get("error.unreachable");
|
error = Core.bundle.get("error.unreachable");
|
||||||
|
@ -9,7 +9,6 @@ import arc.func.*;
|
|||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.async.*;
|
|
||||||
import arc.util.serialization.*;
|
import arc.util.serialization.*;
|
||||||
import club.minnced.discord.rpc.*;
|
import club.minnced.discord.rpc.*;
|
||||||
import com.codedisaster.steamworks.*;
|
import com.codedisaster.steamworks.*;
|
||||||
@ -63,7 +62,8 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown));
|
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown));
|
||||||
}catch(Throwable t){
|
}catch(Throwable t){
|
||||||
useDiscord = false;
|
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;
|
loadError = true;
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
try(OutputStream s = new FileOutputStream(new File("steam-error-log-" + System.nanoTime() + ".txt"))){
|
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());
|
s.write(log.getBytes());
|
||||||
}catch(Exception e2){
|
}catch(Exception e2){
|
||||||
Log.err(e2);
|
Log.err(e2);
|
||||||
|
@ -542,7 +542,7 @@ public class ApplicationTests{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void allBlockTest(){
|
void allBlockTest(){
|
||||||
Tiles tiles = world.resize(256*2 + 20, 10);
|
Tiles tiles = world.resize(256*3 + 20, 10);
|
||||||
|
|
||||||
world.beginMapLoad();
|
world.beginMapLoad();
|
||||||
for(int x = 0; x < tiles.width; x++){
|
for(int x = 0; x < tiles.width; x++){
|
||||||
|
@ -60,6 +60,9 @@ public class SectorTests{
|
|||||||
Seq<SpawnGroup> spawns = state.rules.spawns;
|
Seq<SpawnGroup> spawns = state.rules.spawns;
|
||||||
|
|
||||||
int bossWave = 0;
|
int bossWave = 0;
|
||||||
|
if(state.rules.winWave > 0){
|
||||||
|
bossWave = state.rules.winWave;
|
||||||
|
}else{
|
||||||
outer:
|
outer:
|
||||||
for(int i = 1; i <= 1000; i++){
|
for(int i = 1; i <= 1000; i++){
|
||||||
for(SpawnGroup spawn : spawns){
|
for(SpawnGroup spawn : spawns){
|
||||||
@ -69,6 +72,7 @@ public class SectorTests{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(state.rules.attackMode){
|
if(state.rules.attackMode){
|
||||||
bossWave = 100;
|
bossWave = 100;
|
||||||
|
Reference in New Issue
Block a user