From 4a835bbfb21983cf5bd1cbb708175e175950f375 Mon Sep 17 00:00:00 2001 From: sebthom Date: Thu, 9 Nov 2023 04:29:41 +0100 Subject: [PATCH] fix: grammar parsing errors are not reported in UI --- .../org/eclipse/tm4e/core/registry/Registry.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/Registry.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/Registry.java index 70c5ffe43..3b23dc759 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/Registry.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/Registry.java @@ -16,9 +16,9 @@ */ package org.eclipse.tm4e.core.registry; -import static java.lang.System.Logger.Level.*; -import static org.eclipse.tm4e.core.internal.utils.MoreCollections.*; -import static org.eclipse.tm4e.core.internal.utils.NullSafetyHelper.*; +import static java.lang.System.Logger.Level.WARNING; +import static org.eclipse.tm4e.core.internal.utils.MoreCollections.nullToEmpty; +import static org.eclipse.tm4e.core.internal.utils.NullSafetyHelper.castNonNull; import java.lang.System.Logger; import java.util.HashMap; @@ -160,8 +160,8 @@ private boolean _doLoadSingleGrammar(final String scopeName) { final var grammar = RawGrammarReader.readGrammar(grammarSource); this._syncRegistry.addGrammar(grammar, this._options.getInjections(scopeName)); } catch (final Exception ex) { - LOGGER.log(ERROR, "Loading grammar for scope [{0}] failed: {1}", scopeName, ex.getMessage(), ex); - return false; + throw new TMException("Loading grammar for scope [" + scopeName + "] from [" + + grammarSource.getFilePath() + "] failed: " + ex.getMessage(), ex); } return true; } @@ -185,7 +185,7 @@ public IGrammar addGrammar( this._grammarForScopeName(rawGrammar.getScopeName(), initialLanguage, embeddedLanguages, null, null)); } catch (final Exception ex) { - throw new TMException("Loading grammar from '" + source.getFilePath() + "' failed: " + ex.getMessage(), ex); + throw new TMException("Loading grammar from [" + source.getFilePath() + "] failed: " + ex.getMessage(), ex); } }