Skip to content

Commit

Permalink
fixes #5982
Browse files Browse the repository at this point in the history
- delegate error message

Signed-off-by: Mark Hoffmann <m.hoffmann@data-in-motion.biz>
  • Loading branch information
maho7791 committed Feb 16, 2024
1 parent 1b923e2 commit 2feaf3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions bndtools.core/src/bndtools/launch/util/LaunchUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static Run createRun(ILaunchConfiguration configuration, RunMode mode) th

public static Run createRun(IResource targetResource, RunMode mode) throws Exception {
Run run = null;
String error = null;
for (RunProvider runProvider : getRunProviders()) {
try {
if ((run = runProvider.create(targetResource, mode)) != null) {
Expand All @@ -76,6 +77,9 @@ public static Run createRun(IResource targetResource, RunMode mode) throws Excep
} catch (CoreException e) {
StatusManager.getManager()
.handle(e.getStatus(), StatusManager.BLOCK);
} catch (IllegalStateException ise) {
error = ise.getMessage();
logger.logError("Error in run listener", ise);
} catch (Throwable t) {
logger.logError("Error in run listener", t);
}
Expand All @@ -86,6 +90,9 @@ public static Run createRun(IResource targetResource, RunMode mode) throws Excep
targetResource.getLocation()));
}

if (error != null) {
run.error(error);
}
RunMode.set(run, mode);

for (RunListener runListener : getRunListeners()) {
Expand Down
4 changes: 3 additions & 1 deletion bndtools.m2e/src/bndtools/m2e/MavenRunProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ private Bndrun create0(IResource targetResource, IMavenProjectFacade projectFaca

return mavenBndrunContainer.init(bndrunFile, mode.name(), new File(mavenProject.getBuild()
.getDirectory()));
} else {
throw new IllegalStateException(String
.format("Cannot find a resolver configuration for '%s' in pom.xml.", targetResource.getName()));
}
break;
case TEST :
if ((mojoExecution = getBndTestingMojoExecution(maven, projectFacade, bndrunMatchs, monitor)) != null) {

Expand Down

0 comments on commit 2feaf3a

Please sign in to comment.