jira-node / node-jira-client

A Node.js wrapper for the Jira REST API
https://jira-node.github.io/
MIT License
450 stars 169 forks source link

Return value for deleteIssue? #270

Closed leemrw closed 4 years ago

leemrw commented 4 years ago

As I call deleteIssue I have been trying to examine the return value. The issues are deleted but node-jira-client returns 'undefined'

Am I missing where you document the return values? The Jira docs say their REST interface return a 204, 400, 401, 402, 403 or 404. Is there any way for me to examine the response codes?

randyho-kk commented 4 years ago

anything other than a 204 response (success) will result in a promise rejection.

You can then inspect the reason via err.statusCode

return jira.deleteIssue('SOMEINCORRECTISSUE-123') .then(function() { console.log('delete was successful'); }).catch(function(err) { console.error('delete failed. code: ' + err.statusCode); });