mirror of
https://github.com/appleboy/drone-jenkins.git
synced 2026-06-04 18:23:57 +08:00
feat: improve logging and error handling in Jenkins plugin
- Add error handling for unexpected response codes in `post` method of `jenkins.go` - Import `log` package in `plugin.go` - Add logging for successful job trigger in `Exec` method of `plugin.go` Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@@ -93,6 +93,10 @@ func (jenkins *Jenkins) post(path string, params url.Values, body interface{}) (
|
||||
return
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusCreated {
|
||||
return fmt.Errorf("unexpected response code: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
return jenkins.parseResponse(resp, body)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user