gnustavo / JIRA-REST

Thin wrapper around Jira's REST API
https://metacpan.org/release/JIRA-REST/
17 stars 17 forks source link

Show error details from the JIRA REST API too #1

Closed pepl closed 9 years ago

gnustavo commented 9 years ago

Thanks for the tip, Michael. I didn't know about the 'errors' key in the response hash. Most of the methods in JIRA's REST API documentation don't mention it. Do you happen to know of any other relevant documentation?

I'm thinking about implementing that code more like this:

        if (ref $error eq 'HASH') {
            if (my $errorMessages = $error->{errorMessages}) {
                $msg .= "- $_\n" foreach @$errorMessages;
            }
            if (my $errors = $error->{errors}) {
                $msg .= "- [$_] $errors->{$_}\n" foreach sort keys %$errors;
            }
        } else {
            $msg .= $content;
        }

What do you think?

pepl commented 9 years ago

I saw it in the responss and only found it there https://docs.atlassian.com/jira/REST/latest/jira-rest-plugin.wadl

The updated code will have the same effect (and even shows multiple "errors" if such should exist by a future API version.

Cheers, Michael

gnustavo commented 9 years ago

Michael, I've just released version 0.008 which includes a somewhat different version of this change.

Thank you.