Skip to content

Commit

Permalink
fix(debug): output debug message for failed api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Aug 25, 2020
1 parent 40fdd76 commit 8a0c0f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ const inputs = {
}

// error handler
function errorHandler ({ message, stack }) {
function errorHandler ({ message, stack, request }) {
core.error(`${message}\n${stack}`)

// debugging for API calls
if (request) {
const { method, url, body } = request
core.debug(`${method} ${url} ${body}`)
}

process.exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion action/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function approve (octokit, repo, { number }) {
})
}

export async function comment (octokit, repo, { number }, body) { // eslint-disable-line camelcase
export async function comment (octokit, repo, { number }, body) {
await octokit.issues.createComment({
...repo,
issue_number: number,
Expand Down

0 comments on commit 8a0c0f9

Please sign in to comment.