Keep the orignal error messages with log printing instead swallow them

Signed-off-by: rick <rick@jenkins-zh.cn>
This commit is contained in:
rick
2020-12-01 11:14:42 +08:00
parent d35e22f0be
commit 66dd5ac784

View File

@@ -101,6 +101,7 @@ func (p *Pipeline) GetPipeline() (*devops.Pipeline, error) {
func (p *Pipeline) ListPipelines() (*devops.PipelineList, error) {
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:
@@ -111,7 +112,6 @@ func (p *Pipeline) ListPipelines() (*devops.PipelineList, error) {
klog.Errorf("API '%s' request response code is '%d'", p.Path, jErr.Code)
} else {
err = fmt.Errorf("unknow errors happend when coumunicate with Jenkins")
klog.Error(err)
}
return nil, err
}