From e76acae44ca82c2aeaf5c7fa66df98a051198970 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Thu, 23 Jan 2025 15:36:28 +0100 Subject: [PATCH] show error when fetching templates from Github This shows "some" error in the UI when there are problems fetching from Github. The error message also includes a hint to https://bnd.bndtools.org/instructions/connection-settings.html because sometimes you have a ~/.m2/settings.xml with some credentials which can lead to "Bad Credentials" http errors from the Github API, but before this fix you had no idea what was going on, because the UI was blank and the existance of ~/.m2/settings.xml is easily forgotton Signed-off-by: Christoph Rueger --- .../shared/TemplateSelectionWizardPage.java | 13 +++++++++++-- .../src/org/bndtools/templating/jgit/Cache.java | 15 +++++++++++++++ .../src/org/bndtools/templating/jgit/GitHub.java | 4 ++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java b/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java index 02a58bde57..d1fcc5d1d1 100644 --- a/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java +++ b/bndtools.core/src/org/bndtools/core/ui/wizards/shared/TemplateSelectionWizardPage.java @@ -62,8 +62,8 @@ import org.osgi.service.component.ComponentConstants; import org.osgi.util.promise.Promise; -import aQute.bnd.osgi.Processor; import aQute.bnd.exceptions.Exceptions; +import aQute.bnd.osgi.Processor; import aQute.lib.io.IO; import aQute.libg.tuple.Pair; import bndtools.Plugin; @@ -294,11 +294,20 @@ public void run(IProgressMonitor progress) throws InvocationTargetException { try { Throwable failure = namedPromise.getSecond() .getFailure(); - if (failure != null) + if (failure != null) { + + shell.getDisplay() + .asyncExec(() -> { + txtDescription.setText("Failed to load from template loader (" + name + + ") See Error Log for stack trace: " + + failure.getMessage()); + }); + Plugin.getDefault() .getLog() .log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Failed to load from template loader: " + name, failure)); + } else { Collection