use the new errorhandler & bubble notifs
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
package itdelatrisu.opsu.replay;
|
||||
|
||||
import itdelatrisu.opsu.ErrorHandler;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.ScoreData;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
@@ -45,6 +44,9 @@ import org.apache.commons.compress.compressors.lzma.LZMACompressorInputStream;
|
||||
import org.newdawn.slick.util.Log;
|
||||
|
||||
import lzma.streams.LzmaOutputStream;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
|
||||
/**
|
||||
* Captures osu! replay data.
|
||||
@@ -273,7 +275,7 @@ public class Replay {
|
||||
File dir = Options.getReplayDir();
|
||||
if (!dir.isDirectory()) {
|
||||
if (!dir.mkdir()) {
|
||||
ErrorHandler.error("Failed to create replay directory.", null, false);
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Failed to create replay directory.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -343,7 +345,7 @@ public class Replay {
|
||||
compressedOut.write(bytes);
|
||||
} catch (IOException e) {
|
||||
// possible OOM: https://github.com/jponge/lzma-java/issues/9
|
||||
ErrorHandler.error("LZMA compression failed (possible out-of-memory error).", e, true);
|
||||
ErrorHandler.error("LZMA compression failed (possible out-of-memory error).", e).show();
|
||||
}
|
||||
compressedOut.close();
|
||||
bout.close();
|
||||
@@ -357,7 +359,7 @@ public class Replay {
|
||||
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
ErrorHandler.error("Could not save replay data.", e, true);
|
||||
ErrorHandler.error("Could not save replay data.", e).show();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package itdelatrisu.opsu.replay;
|
||||
|
||||
import itdelatrisu.opsu.ErrorHandler;
|
||||
import com.sun.deploy.security.EnhancedJarVerifier;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
||||
@@ -31,6 +31,8 @@ import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import org.newdawn.slick.util.Log;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
|
||||
/**
|
||||
* Importer for replay files.
|
||||
@@ -70,7 +72,9 @@ public class ReplayImporter {
|
||||
File replayDir = Options.getReplayDir();
|
||||
if (!replayDir.isDirectory()) {
|
||||
if (!replayDir.mkdir()) {
|
||||
ErrorHandler.error(String.format("Failed to create replay directory '%s'.", replayDir.getAbsolutePath()), null, false);
|
||||
String err = String.format("Failed to create replay directory '%s'.", replayDir.getAbsolutePath());
|
||||
Log.error(err);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +87,9 @@ public class ReplayImporter {
|
||||
r.loadHeader();
|
||||
} catch (IOException e) {
|
||||
moveToFailedDirectory(file);
|
||||
ErrorHandler.error(String.format("Failed to import replay '%s'. The replay file could not be parsed.", file.getName()), e, false);
|
||||
String err = String.format("Failed to import replay '%s'. The replay file could not be parsed.", file.getName());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
continue;
|
||||
}
|
||||
Beatmap beatmap = BeatmapSetList.get().getBeatmapFromHash(r.beatmapHash);
|
||||
@@ -100,8 +106,9 @@ public class ReplayImporter {
|
||||
}
|
||||
} else {
|
||||
moveToFailedDirectory(file);
|
||||
ErrorHandler.error(String.format("Failed to import replay '%s'. The associated beatmap could not be found.", file.getName()), null, false);
|
||||
continue;
|
||||
String err = String.format("Failed to import replay '%s'. The associated beatmap could not be found.", file.getName());
|
||||
Log.error(err);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user