mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
ba7cc13145
There should be no reason to use gopkg.in versioned imports now that we're using go modules. I think, IANAE. gopkg.in kind of gets in the way of modules, as it only pulls over tagged releases from github.com -- this then means that you need to use go modules 'replace' syntax in the go.mod to use a non-versioned commit or branch. This is feasible, but kind of ugly. go modules defaults to pulling the latest version, so the default behavior is the same as when pulling go-jira.v1 from gopkg.in.
22 lines
546 B
Go
22 lines
546 B
Go
package jira
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/go-jira/jira/jiradata"
|
|
)
|
|
|
|
func responseError(resp *http.Response) error {
|
|
results := &jiradata.ErrorCollection{}
|
|
if err := json.NewDecoder(resp.Body).Decode(results); err != nil {
|
|
results.Status = resp.StatusCode
|
|
results.ErrorMessages = append(results.ErrorMessages, err.Error())
|
|
}
|
|
if len(results.ErrorMessages) == 0 && len(results.Errors) == 0 {
|
|
results.Status = resp.StatusCode
|
|
results.ErrorMessages = append(results.ErrorMessages, resp.Status)
|
|
}
|
|
return results
|
|
}
|