本文整理匯總了Golang中github.com/telemetryapp/gotelemetry_agent/agent/job.Job.SetFlowError方法的典型用法代碼示例。如果您正苦於以下問題:Golang Job.SetFlowError方法的具體用法?Golang Job.SetFlowError怎麽用?Golang Job.SetFlowError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/telemetryapp/gotelemetry_agent/agent/job.Job
的用法示例。
在下文中一共展示了Job.SetFlowError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: performAllTasks
func (p *ProcessPlugin) performAllTasks(j *job.Job) {
j.Debugf("Starting process plugin...")
defer p.PluginHelper.TrackTime(j, time.Now(), "Process plugin completed in %s.")
var response string
var err error
if p.path != "" {
response, err = p.performScriptTask(j)
} else if p.templateFile != "" {
response, err = p.performTemplateTask(j)
} else if p.url != "" {
response, err = p.performHTTPTask(j)
} else {
err = errors.New("Nothing to do!")
}
if err != nil {
if p.flowTag != "" {
res := err.Error() + " : " + strings.TrimSpace(string(response))
if res == "" {
res = "No output detected."
}
j.SetFlowError(p.flowTag, map[string]interface{}{"message": res})
}
j.ReportError(err)
return
}
j.Debugf("Process output: %s", strings.Replace(response, "\n", "\\n", -1))
if p.flowTag != "" {
j.Debugf("Posting flow %s", p.flowTag)
}
if err := p.analyzeAndSubmitProcessResponse(j, response); err != nil {
j.ReportError(errors.New("Unable to analyze process output: " + err.Error()))
}
}