Log the more raw error message from Twirp

This commit is contained in:
James M. Greene
2023-12-22 12:53:15 -06:00
parent 013b725db3
commit d6fbcf80b1
2 changed files with 11 additions and 0 deletions

View File

@@ -194,6 +194,11 @@ describe('Deployment', () => {
)
expect(core.error).toHaveBeenNthCalledWith(
1,
'Listing artifact metadata failed',
new Error('Failed to ListArtifacts: Received non-retryable error: Failed request: (400) null: yikes!')
)
expect(core.error).toHaveBeenNthCalledWith(
2,
'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.',
expect.any(Error)
)
@@ -416,6 +421,11 @@ describe('Deployment', () => {
)
expect(core.error).toHaveBeenNthCalledWith(
1,
'Listing artifact metadata failed',
new Error('Failed to ListArtifacts: Received non-retryable error: Failed request: (501) null: oh no')
)
expect(core.error).toHaveBeenNthCalledWith(
2,
'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.',
expect.any(Error)
)

View File

@@ -70,6 +70,7 @@ async function getArtifactMetadata({ artifactName }) {
const twirpResponse = await artifactClient.listArtifacts()
response = wrapTwirpResponseLikeOctokit(twirpResponse, requestOptions)
} catch (twirpError) {
core.error('Listing artifact metadata failed', twirpError)
const octokitError = wrapTwirpErrorLikeOctokit(twirpError, requestOptions)
throw octokitError
}