Skip to content

Commit

Permalink
Merge pull request #6038 from maho7791/error-msg
Browse files Browse the repository at this point in the history
fixes #5982 create an error message
  • Loading branch information
pkriens committed Mar 15, 2024
2 parents 5c6f7da + 2feaf3a commit cf750fb
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 @@ -139,8 +139,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 cf750fb

Please sign in to comment.