未验证 提交 18bb1c11 编写于 作者: K KubeSphere CI Bot 提交者: GitHub

Merge pull request #3145 from LinuxSuRen/master

Provide a hunman readable error message instead of the raw
......@@ -18,6 +18,7 @@ package jenkins
import (
"encoding/json"
"fmt"
"github.com/PuerkitoBio/goquery"
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
......@@ -98,9 +99,20 @@ func (p *Pipeline) GetPipeline() (*devops.Pipeline, error) {
}
func (p *Pipeline) ListPipelines() (*devops.PipelineList, error) {
res, err := p.Jenkins.SendPureRequest(p.Path, p.HttpParameters)
if err != nil {
klog.Error(err)
res, _, err := p.Jenkins.SendPureRequestWithHeaderResp(p.Path, p.HttpParameters)
if err != nil {
klog.Error(err)
if jErr, ok := err.(*JkError); ok {
switch jErr.Code {
case 404:
err = fmt.Errorf("please check if there're any Jenkins plugins issues exist")
default:
err = fmt.Errorf("please check if Jenkins is running well")
}
klog.Errorf("API '%s' request response code is '%d'", p.Path, jErr.Code)
} else {
err = fmt.Errorf("unknow errors happend when coumunicate with Jenkins")
}
return nil, err
}
count, err := p.searchPipelineCount()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册