diff --git a/Rekeningsysteem/src/main/java/org/rekeningsysteem/application/settings/offerte/DefaultOfferteTextPaneController.java b/Rekeningsysteem/src/main/java/org/rekeningsysteem/application/settings/offerte/DefaultOfferteTextPaneController.java index 006d330..b01b783 100644 --- a/Rekeningsysteem/src/main/java/org/rekeningsysteem/application/settings/offerte/DefaultOfferteTextPaneController.java +++ b/Rekeningsysteem/src/main/java/org/rekeningsysteem/application/settings/offerte/DefaultOfferteTextPaneController.java @@ -3,8 +3,14 @@ import java.io.IOException; import javafx.event.ActionEvent; +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonType; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.ButtonBar.ButtonData; +import org.apache.log4j.Logger; import org.rekeningsysteem.exception.NoSuchFileException; +import org.rekeningsysteem.logging.ApplicationLogger; import org.rekeningsysteem.logic.offerte.DefaultOfferteTextHandler; import rx.Observable; @@ -13,6 +19,8 @@ public class DefaultOfferteTextPaneController { private final DefaultOfferteTextPane ui; private final DefaultOfferteTextHandler handler = new DefaultOfferteTextHandler(); + + private final Logger logger = ApplicationLogger.getInstance(); public DefaultOfferteTextPaneController() { this.ui = new DefaultOfferteTextPane(); @@ -29,10 +37,16 @@ public DefaultOfferteTextPaneController() { this.handler.setDefaultText(s); } catch (IOException e) { - e.printStackTrace(); + this.logger.error("Error while writing default offerte text to file.", e); } catch (NoSuchFileException e) { - e.printStackTrace(); + String alertText = "De tekst kon niet worden opgeslagen. Raadpleeg " + + "de programmeur om dit probleem op te lossen."; + ButtonType close = new ButtonType("Sluit", ButtonData.CANCEL_CLOSE); + Alert alert = new Alert(AlertType.NONE, alertText, close); + alert.setHeaderText("Fout bij opslaan"); + alert.show(); + this.logger.error(e.getMessage() + "\n" + "De tekst was: \"" + s + "\"\n", e); } }); cancel.subscribe(e -> {