Added ErrorHandler class to handle all critical errors.
This mostly replaces the Slick2D Log class for error reporting. Most game errors will now trigger the error popup. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package itdelatrisu.opsu.audio;
|
||||
|
||||
import itdelatrisu.opsu.ErrorHandler;
|
||||
import itdelatrisu.opsu.OsuFile;
|
||||
import itdelatrisu.opsu.OsuParser;
|
||||
import itdelatrisu.opsu.states.Options;
|
||||
@@ -35,7 +36,6 @@ import org.newdawn.slick.Music;
|
||||
import org.newdawn.slick.SlickException;
|
||||
import org.newdawn.slick.openal.Audio;
|
||||
import org.newdawn.slick.openal.SoundStore;
|
||||
import org.newdawn.slick.util.Log;
|
||||
|
||||
/**
|
||||
* Controller for all music.
|
||||
@@ -132,7 +132,7 @@ public class MusicController {
|
||||
player = new Music(file.getPath());
|
||||
playAt((previewTime > 0) ? previewTime : 0, loop);
|
||||
} catch (Exception e) {
|
||||
Log.error(String.format("Could not play track '%s'.", file.getName()), e);
|
||||
ErrorHandler.error(String.format("Could not play track '%s'.", file.getName()), e, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public class MusicController {
|
||||
converter.convert(file.getPath(), wavFile.getPath());
|
||||
return wavFile;
|
||||
} catch (Exception e) {
|
||||
Log.error(String.format("Failed to play file '%s'.", file.getAbsolutePath()), e);
|
||||
ErrorHandler.error(String.format("Failed to play file '%s'.", file.getAbsolutePath()), e, false);
|
||||
}
|
||||
return wavFile;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ public class MusicController {
|
||||
|
||||
player = null;
|
||||
} catch (Exception e) {
|
||||
Log.error("Failed to destroy OpenAL.", e);
|
||||
ErrorHandler.error("Failed to destroy OpenAL.", e, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package itdelatrisu.opsu.audio;
|
||||
|
||||
import itdelatrisu.opsu.ErrorHandler;
|
||||
import itdelatrisu.opsu.OsuHitObject;
|
||||
import itdelatrisu.opsu.audio.HitSound.SampleSet;
|
||||
import itdelatrisu.opsu.states.Options;
|
||||
@@ -34,7 +35,6 @@ import javax.sound.sampled.FloatControl;
|
||||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
|
||||
import org.newdawn.slick.util.Log;
|
||||
import org.newdawn.slick.util.ResourceLoader;
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ public class SoundController {
|
||||
clip.open(audioIn);
|
||||
return clip;
|
||||
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException | RuntimeException e) {
|
||||
Log.error(String.format("Failed to load file '%s'.", ref), e);
|
||||
ErrorHandler.error(String.format("Failed to load file '%s'.", ref), e, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user