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