Subject: | Error messages don't include the content of the response, which contains important information |
For example, currently an error report might say:
Error creating new JIRA issue Foo test 400 Bad Request
but if the content was included in would say:
Error creating new JIRA issue Foo test 400 Bad Request {"errorMessages":[],"errors":{"project":"project is required"}}
which is much more helpful.
We could bike shed the formatting, but just reporting the jaw json seems fine as a minimum:
die "Error creating new JIRA issue $fields->{summary} " . $response->status_line() . " " . $response->content;
I'd also suggest:
a) add a _make_request($request) method that does the authorization_basic call, the $self->{_ua}->request($request) call and the is_success check.
b) refactor the code to use _make_request in all the methods (9!) that currently duplicate that logic
c) add an error_response_handler attribute that's a code ref that default to the die shown above
d) use that in _make_request so now apps can provide their own error handling
I could send you a patch for the above if you'd like. Or, even better, a pull request if you put the code on github.