Skip to content

Commit

Permalink
Improve error logging (#76)
Browse files Browse the repository at this point in the history
* Improve error logging

* Update build
  • Loading branch information
sammacbeth authored Sep 25, 2023
1 parent 98b4d9f commit 0472863
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
14 changes: 11 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asana, {Client} from 'asana'
import {info, setFailed, getInput, debug} from '@actions/core'
import {info, setFailed, getInput, debug, error} from '@actions/core'
import {context} from '@actions/github'
import {PullRequest, PullRequestEvent} from '@octokit/webhooks-types'

Expand Down Expand Up @@ -73,8 +73,13 @@ async function run(): Promise<void> {
}
info('Only runs for PR changes')
// core.setOutput('time', new Date().toTimeString())
} catch (error) {
if (error instanceof Error) setFailed(error.message)
} catch (e) {
if (e instanceof Error) {
if ((<any>e).value) {
error((<any>e).value)
}
setFailed(e.message)
}
}
}

Expand All @@ -99,6 +104,9 @@ async function findCustomFields(workspaceGid: string) {
if (!githubUrlField || !githubStatusField) {
debug(JSON.stringify(customFields))
throw new Error('Custom fields are missing. Please create them')
} else {
debug(`${CUSTOM_FIELD_NAMES.url} field GID: ${githubUrlField?.gid}`)
debug(`${CUSTOM_FIELD_NAMES.status} field GID: ${githubStatusField?.gid}`)
}
return {
url: githubUrlField,
Expand Down

0 comments on commit 0472863

Please sign in to comment.