From 81c76ae9d48aa35b763f0117d1150c38872f7b5f Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 25 Apr 2021 22:46:07 +0200 Subject: [PATCH] Make error output labels consistent --- src/main/java/app/controllers/FiletreeController.java | 5 +++-- src/main/java/app/service/FileOperations.java | 7 ++++--- src/main/java/app/service/FiletreeOperations.java | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/app/controllers/FiletreeController.java b/src/main/java/app/controllers/FiletreeController.java index aa09653..5146680 100644 --- a/src/main/java/app/controllers/FiletreeController.java +++ b/src/main/java/app/controllers/FiletreeController.java @@ -91,7 +91,8 @@ public class FiletreeController implements Initializable, Controller { this.eventBus.post(new OpenFileEvent(Optional.ofNullable(path))); } } catch (FileNotFoundException e) { - System.err.println("[ERROR]: Could not find filepath from filetree"); + System.err.println("[ERROR] Could not find filepath from filetree"); + System.err.print(e); } } } @@ -108,7 +109,7 @@ public class FiletreeController implements Initializable, Controller { private void handle(OpenProjectEvent event) { event.getPath().ifPresentOrElse( path -> this.showTree(path.toString()), - () -> System.err.println("[ERROR]: OpenProjectEvent was empty!") + () -> System.err.println("[ERROR] OpenProjectEvent was empty") ); } diff --git a/src/main/java/app/service/FileOperations.java b/src/main/java/app/service/FileOperations.java index f236f78..1820a21 100644 --- a/src/main/java/app/service/FileOperations.java +++ b/src/main/java/app/service/FileOperations.java @@ -89,9 +89,10 @@ public class FileOperations { result += (sc.nextLine() + "\n"); } - } catch (FileNotFoundException ex) { - DialogBoxes.showErrorMessage("Could not be opened!"); - System.err.println(filePath); + } catch (FileNotFoundException e) { + DialogBoxes.showErrorMessage("This file could not be opened!"); + System.err.println("[ERROR] File could not be opened: " + filePath.toString()); + System.err.print(e); } return result; diff --git a/src/main/java/app/service/FiletreeOperations.java b/src/main/java/app/service/FiletreeOperations.java index b8bb21d..b3fd749 100644 --- a/src/main/java/app/service/FiletreeOperations.java +++ b/src/main/java/app/service/FiletreeOperations.java @@ -64,8 +64,8 @@ public class FiletreeOperations { parent.getChildren().add(element); } catch (Exception e) { - System.err.print(e); - System.err.println("[ERROR]: DEFAULT FILE ICON NOT FOUND"); + System.err.println("[ERROR] Default file icon not found"); + System.err.println(e); } } } @@ -99,7 +99,7 @@ public class FiletreeOperations { icon = new Image(imageData); } catch (IOException e) { - System.err.println("[WARNING]: ICON NOT FOUND: " + file.getPath()); + System.err.println("[WARNING] Icon not found: " + file.getPath()); // String iconPath = "/graphics/filetreeicons/file.png"; String iconPath = "/graphics/filetreeicons/unknown.png";