本文整理汇总了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);
}
}