Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

[JENKINS-29220] Handle InterruptedException properly #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,18 @@ private String buildGetUrl(String job, String securityToken) {
*/
private void failBuild(Exception e, BuildListener listener) throws IOException {
System.out.print(e.getStackTrace());
if (this.getShouldNotFailBuild()) {
if (this.getShouldNotFailBuild() && !(e instanceof InterruptedException)) {
listener.error("Remote build failed for the following reason, but the build will continue:");
listener.error(e.getMessage());
} else {
listener.error("Remote build failed for the following reason:");
throw new AbortException(e.getMessage());
if(e instanceof InterruptedException){
listener.error("Build cancelled by user");
throw new AbortException("Build cancelled by user");
} else
{
listener.error("Remote build failed for the following reason:");
throw new AbortException(e.getMessage());
}
}
}

Expand Down Expand Up @@ -778,8 +784,8 @@ public String getBuildUrl(String buildUrlString, AbstractBuild build, BuildListe

public String getConsoleOutput(String urlString, String requestType, AbstractBuild build, BuildListener listener)
throws IOException {
return getConsoleOutput( urlString, requestType, build, listener, 1 );

return getConsoleOutput( urlString, requestType, build, listener, 1 );
}

/**
Expand Down