From f3ab014e3f50019018e00b4c88bce503997c5069 Mon Sep 17 00:00:00 2001 From: marhali Date: Thu, 3 Feb 2022 16:40:43 +0100 Subject: [PATCH] improve exception details on io ops --- .../de/marhali/easyi18n/util/NotificationHelper.java | 12 +++++++++--- src/main/resources/messages.properties | 5 ++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/marhali/easyi18n/util/NotificationHelper.java b/src/main/java/de/marhali/easyi18n/util/NotificationHelper.java index caf4451..44dae30 100644 --- a/src/main/java/de/marhali/easyi18n/util/NotificationHelper.java +++ b/src/main/java/de/marhali/easyi18n/util/NotificationHelper.java @@ -1,6 +1,9 @@ package de.marhali.easyi18n.util; import com.intellij.openapi.diagnostic.Logger; +import de.marhali.easyi18n.ionext.IOHandler; +import de.marhali.easyi18n.model.SettingsState; +import org.jetbrains.annotations.NotNull; import java.text.MessageFormat; import java.util.ResourceBundle; @@ -10,9 +13,12 @@ import java.util.ResourceBundle; * @author marhali */ public class NotificationHelper { - public static void createIOError(String fileName, Class ioStrategy, Exception ex) { + public static void createIOError(@NotNull SettingsState state, Exception ex) { ResourceBundle bundle = ResourceBundle.getBundle("messages"); - String message = MessageFormat.format(bundle.getString("error.io"), fileName, ioStrategy.getSimpleName()); - Logger.getInstance(ioStrategy).error(message, ex); + + String message = MessageFormat.format(bundle.getString("error.io"), + state.getFolderStrategy(), state.getParserStrategy(), state.getFilePattern(), state.getLocalesPath()); + + Logger.getInstance(IOHandler.class).error(message, ex); } } \ No newline at end of file diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index c71c1a8..81d0b2b 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -25,4 +25,7 @@ settings.path.prefix=Path prefix settings.keys.sort=Sort translation keys alphabetically settings.keys.nested=Escape delimiter character within a section layer. settings.editor.assistance=I18n key completion, annotation and reference inside editor -error.io=Could not process file {0} with {1}. Unwanted files can be ignored via Translation file wildcard matcher option. \ No newline at end of file +error.io=An error occurred while processing translation files. \n\ + Config: {0} => {1} ({2}) \n\ + Path: {3} \n\ + Please check examples at https://github.com/marhali/easy-i18n before reporting an issue! \ No newline at end of file