Keep the orignal error messages with log printing instead swallow them
Signed-off-by: rick <rick@jenkins-zh.cn>
This commit is contained in:
@@ -101,6 +101,7 @@ func (p *Pipeline) GetPipeline() (*devops.Pipeline, error) {
|
|||||||
func (p *Pipeline) ListPipelines() (*devops.PipelineList, error) {
|
func (p *Pipeline) ListPipelines() (*devops.PipelineList, error) {
|
||||||
res, _, err := p.Jenkins.SendPureRequestWithHeaderResp(p.Path, p.HttpParameters)
|
res, _, err := p.Jenkins.SendPureRequestWithHeaderResp(p.Path, p.HttpParameters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
klog.Error(err)
|
||||||
if jErr, ok := err.(*JkError); ok {
|
if jErr, ok := err.(*JkError); ok {
|
||||||
switch jErr.Code {
|
switch jErr.Code {
|
||||||
case 404:
|
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)
|
klog.Errorf("API '%s' request response code is '%d'", p.Path, jErr.Code)
|
||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("unknow errors happend when coumunicate with Jenkins")
|
err = fmt.Errorf("unknow errors happend when coumunicate with Jenkins")
|
||||||
klog.Error(err)
|
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user