mirror of
https://github.com/actions/configure-pages.git
synced 2026-04-04 16:52:12 +00:00
Fix superfluous HttpError: Not Found by throwing user-friendly errors
Instead of logging a detailed error with core.error() and then re-throwing the raw HTTP error (which gets logged again by core.setFailed() in index.js), throw a new Error with the user-friendly message directly. This eliminates the duplicate/superfluous raw error output like "HttpError: Not Found". Fixes #125 Agent-Logs-Url: https://github.com/actions/configure-pages/sessions/ee6b7f39-cfc5-415b-b70c-826c2b8cfcfe Co-authored-by: yoannchaudet <14911070+yoannchaudet@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a55b1f3f2e
commit
742261a77d
12
dist/index.js
vendored
12
dist/index.js
vendored
@@ -36419,11 +36419,9 @@ async function findOrCreatePagesSite({ githubToken, enablement = true }) {
|
||||
pageObject = await getPagesSite({ githubToken })
|
||||
} catch (error) {
|
||||
if (!enablement) {
|
||||
core.error(
|
||||
`Get Pages site failed. Please verify that the repository has Pages enabled and configured to build using GitHub Actions, or consider exploring the \`enablement\` parameter for this action. Error: ${error.message}`,
|
||||
convertErrorToAnnotationProperties(error)
|
||||
throw new Error(
|
||||
`Get Pages site failed. Please verify that the repository has Pages enabled and configured to build using GitHub Actions, or consider exploring the \`enablement\` parameter for this action.`
|
||||
)
|
||||
throw error
|
||||
}
|
||||
core.warning(`Get Pages site failed. Error: ${error.message}`, convertErrorToAnnotationProperties(error))
|
||||
}
|
||||
@@ -36433,8 +36431,7 @@ async function findOrCreatePagesSite({ githubToken, enablement = true }) {
|
||||
try {
|
||||
pageObject = await enablePagesSite({ githubToken })
|
||||
} catch (error) {
|
||||
core.error(`Create Pages site failed. Error: ${error.message}`, convertErrorToAnnotationProperties(error))
|
||||
throw error
|
||||
throw new Error(`Create Pages site failed. Error: ${error.message}`)
|
||||
}
|
||||
|
||||
// This somehow implies that the Pages site was already created but initially failed to be retrieved.
|
||||
@@ -36443,8 +36440,7 @@ async function findOrCreatePagesSite({ githubToken, enablement = true }) {
|
||||
try {
|
||||
pageObject = await getPagesSite({ githubToken })
|
||||
} catch (error) {
|
||||
core.error(`Get Pages site still failed. Error: ${error.message}`, convertErrorToAnnotationProperties(error))
|
||||
throw error
|
||||
throw new Error(`Get Pages site still failed. Error: ${error.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user