Skip to content

Commit

Permalink
Merge pull request #181 from res0nance/remove-exception
Browse files Browse the repository at this point in the history
Only log top level exception on WARNING when deleting
  • Loading branch information
bitwiseman authored Feb 7, 2020
2 parents 7145d99 + a432d29 commit e3ef78c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/jenkins/branch/WorkspaceLocatorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,17 @@ public void onOnline(Computer c, TaskListener listener) throws IOException, Inte
try {
child.deleteRecursive();
} catch (IOException x) {
LOGGER.log(Level.WARNING, "could not delete workspace " + child, x);
listener.getLogger().println("could not delete workspace " + child + " , wrong file ownership? Review exception in jenkins log and manually remove the directory");
//Prevent flooding logs if recursive delete fails
if (x.getSuppressed().length != 0) {
IOException e = new IOException(x.getMessage(), x.getCause());
e.setStackTrace(x.getStackTrace());
LOGGER.log(Level.WARNING, "could not delete workspace " + child + " on " + node.getNodeName() + " check finer logs for more information", e);
LOGGER.log(Level.FINE, "could not delete workspace " + child + " on " + node.getNodeName() , x);
} else {
LOGGER.log(Level.WARNING, "could not delete workspace " + child + " on " + node.getNodeName(), x);
}
listener.getLogger().println("could not delete workspace " + child + " on " + node.getNodeName()
+ " , wrong file ownership? Review exception in jenkins log and manually remove the directory");
}
}
}
Expand Down

0 comments on commit e3ef78c

Please sign in to comment.