From a802f9f758f3664c60136282c2a8265ebcf1a00a Mon Sep 17 00:00:00 2001 From: Aizistral Date: Mon, 26 Jun 2023 16:40:31 +0200 Subject: Improve config IO error handling --- .../com/aizistral/nochatreports/common/config/JSONConfig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/aizistral/nochatreports/common/config/JSONConfig.java b/src/main/java/com/aizistral/nochatreports/common/config/JSONConfig.java index 9c7c2e9..f8fe3b4 100644 --- a/src/main/java/com/aizistral/nochatreports/common/config/JSONConfig.java +++ b/src/main/java/com/aizistral/nochatreports/common/config/JSONConfig.java @@ -62,8 +62,8 @@ public abstract class JSONConfig { NCRCore.LOGGER.fatal("Could not read config file: {}", file); NCRCore.LOGGER.fatal("This likely indicates the file is corrupted. " + "You can try deleting it to fix this problem. Full stacktrace below:"); - ex.printStackTrace(); - return null; + NCRCore.LOGGER.catching(ex); + throw new RuntimeException("Could not read config file: " + file, ex); } } @@ -77,7 +77,9 @@ public abstract class JSONConfig { } } catch (Exception ex) { NCRCore.LOGGER.fatal("Could not write config file: {}", file); - throw new RuntimeException(ex); + NCRCore.LOGGER.fatal("Full stacktrace below:"); + NCRCore.LOGGER.catching(ex); + throw new RuntimeException("Could not write config file: " + file,ex); } } -- cgit v1.2.3