本文整理匯總了Java中hudson.model.TaskListener.error方法的典型用法代碼示例。如果您正苦於以下問題:Java TaskListener.error方法的具體用法?Java TaskListener.error怎麽用?Java TaskListener.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hudson.model.TaskListener
的用法示例。
在下文中一共展示了TaskListener.error方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onFailure
import hudson.model.TaskListener; //導入方法依賴的package包/類
@Override public void onFailure(StepContext context, Throwable t) {
try {
TaskListener listener = context.get(TaskListener.class);
Result r = Result.FAILURE;
if (t instanceof AbortException) {
listener.error(t.getMessage());
} else if (t instanceof FlowInterruptedException) {
FlowInterruptedException fie = (FlowInterruptedException) t;
fie.handle(context.get(Run.class), listener);
r = fie.getResult();
} else {
listener.getLogger().println(Functions.printThrowable(t).trim()); // TODO 2.43+ use Functions.printStackTrace
}
context.get(Run.class).setResult(r);
context.onSuccess(null);
} catch (Exception x) {
context.onFailure(x);
}
}
示例2: markAsUnstableWhenAtRiskThreshold
import hudson.model.TaskListener; //導入方法依賴的package包/類
private void markAsUnstableWhenAtRiskThreshold(int threshold, CodeSceneBuildActionEntry entry, Run<?, ?> build, TaskListener listener) throws IOException {
if (isMarkBuildAsUnstable() && entry.getHitsRiskThreshold()) {
String link = HyperlinkNote.encodeTo(entry.getViewUrl().toExternalForm(), String.format("Delta analysis result with risk %d", entry.getRisk().getValue()));
listener.error("%s hits the risk threshold (%d). Marking build as unstable.", link, threshold);
Result newResult = Result.UNSTABLE;
Result result = build.getResult();
if (result != null) {
build.setResult(result.combine(newResult));
} else {
build.setResult(newResult);
}
}
}
示例3: onFailure
import hudson.model.TaskListener; //導入方法依賴的package包/類
@Override
public void onFailure(StepContext context, Throwable t) {
try {
if (t instanceof FlowInterruptedException) {
for (CauseOfInterruption cause : ((FlowInterruptedException) t).getCauses()) {
if (cause instanceof CauseOfInterruption.UserInterruption) {
context.onFailure(t);
return;
}
}
}
left--;
if (left>0) {
TaskListener l = context.get(TaskListener.class);
if (t instanceof AbortException) {
l.error(t.getMessage());
} else {
l.error("Execution failed").println(Functions.printThrowable(t).trim()); // TODO 2.43+ use Functions.printStackTrace
}
l.getLogger().println("Retrying");
context.newBodyInvoker().withCallback(this).start();
} else {
// No need to print anything in this case, since it will be thrown up anyway.
context.onFailure(t);
}
} catch (Throwable p) {
context.onFailure(p);
}
}