You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am abstracting the process of transitioning a Jira issue to a different state. When attempting to transition an issue from Backlog to Ready, the Jira web app raises an error telling me I need to define the story points. I'd like to handle this error when automating the process. I have the following function:
func (j*JiraIssue) UpdateStatus(statusIdJiraStatus) error {
possibleTransitions, _, _:=jiraClient.Issue.GetTransitions(j.JiraKey)
for_, v:=rangepossibleTransitions {
log.Debugf("Available transition: %s %s \n", v.To.ID, v.Name)
ifv.To.ID==string(statusId) {
resp, err:=jiraClient.Issue.DoTransition(j.JiraKey, string(statusId))
body, read_err:=io.ReadAll(resp.Body)
ifread_err!=nil {
returnread_err
}
iferr!=nil {
returnfmt.Errorf("%s: %v", err, string(body))
}
returnnil
}
}
returnfmt.Errorf("requested status change %v is not available for this issue", statusId)
}
I am trying to read the response body if there is an error transitioning the issue. But I get the following error when trying to do so:
http: read on closed response body
How can I read the error response from the API?
Expected behavior
The jira.Response returned from DoTransition should be readable.
Your Environment
Include as many relevant details about the environment you experienced the problem in
go-jira version (git tag or sha): v1.15.1
Go version (go version): 1.18.3
Jira version: 8.13.11
Jira type (cloud or on-premise): On prem
Additional context
I'd like to be able to dynamically handle error responses that come from the API. Or at least be able to print a more helpful error message when a request to transition the issue fails.
Thanks!
The text was updated successfully, but these errors were encountered:
In case of an error, go-jira reads and decodes the response body and returns it as an error, see the code for DoTransitionWithPayloadWithContext and NewJiraError.
I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.
However, there is news: We are kicking off v2 of this library 🚀
To provide visibility, we created the Road to v2 Milestone and calling for your feedback in #489
The development will take some time; however, I hope you can benefit from the changes.
If you seek priority development for your issue + you like to sponsor it, please contact me.
What does this mean for my issue?
We will work on this issue indirectly.
This means that during the development phase, we aim to tackle it.
Maybe in a different way like it is currently handled.
Please understand that this will take a while because we are running this in our spare time.
Final words
Thanks for using this library.
If there is anything else you would like to tell us, let us know!
Describe the bug
I am abstracting the process of transitioning a Jira issue to a different state. When attempting to transition an issue from
Backlog
toReady
, the Jira web app raises an error telling me I need to define the story points. I'd like to handle this error when automating the process. I have the following function:I am trying to read the response body if there is an error transitioning the issue. But I get the following error when trying to do so:
How can I read the error response from the API?
Expected behavior
The
jira.Response
returned fromDoTransition
should be readable.Your Environment
Include as many relevant details about the environment you experienced the problem in
v1.15.1
go version
):1.18.3
8.13.11
Additional context
I'd like to be able to dynamically handle error responses that come from the API. Or at least be able to print a more helpful error message when a request to transition the issue fails.
Thanks!
The text was updated successfully, but these errors were encountered: