Add Exception Logging
This commit is contained in:
parent
e4e5e6376c
commit
03a1596420
@ -115,5 +115,8 @@ public final class AudioRecorder {
|
||||
public void cancel() {
|
||||
line.stop();
|
||||
line.close();
|
||||
try {
|
||||
Files.deleteIfExists(tempFile);
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,16 @@
|
||||
package envoy.client.ui;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
import envoy.client.data.audio.AudioPlayer;
|
||||
import envoy.exception.EnvoyException;
|
||||
import envoy.util.EnvoyLog;
|
||||
|
||||
/**
|
||||
* Enables the play back of audio clips through a button.
|
||||
@ -20,6 +26,8 @@ public final class AudioControl extends HBox {
|
||||
|
||||
private AudioPlayer player = new AudioPlayer();
|
||||
|
||||
private static final Logger logger = EnvoyLog.getLogger(AudioControl.class);
|
||||
|
||||
/**
|
||||
* Initializes the audio control.
|
||||
*
|
||||
@ -32,7 +40,8 @@ public final class AudioControl extends HBox {
|
||||
try {
|
||||
player.play(audioData);
|
||||
} catch (EnvoyException ex) {
|
||||
|
||||
logger.log(Level.SEVERE, "Could not play back audio: ", ex);
|
||||
new Alert(AlertType.ERROR, "Could not play back audio").showAndWait();
|
||||
}
|
||||
});
|
||||
getChildren().add(button);
|
||||
|
@ -263,7 +263,8 @@ public final class ChatScene {
|
||||
Platform.runLater(() -> { voiceButton.setText("Record Voice Message"); checkPostConditions(false); });
|
||||
}
|
||||
} catch (EnvoyException e) {
|
||||
e.printStackTrace();
|
||||
logger.log(Level.SEVERE, "Could not record audio: ", e);
|
||||
Platform.runLater(new Alert(AlertType.ERROR, "Could not record audio")::showAndWait);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
Reference in New Issue
Block a user