mirror of
https://github.com/gradle/actions.git
synced 2025-08-24 10:51:27 +08:00
Retain and log stacktrace for submission errors
This commit is contained in:
parent
6ccde15122
commit
d124ec149f
@ -124,17 +124,16 @@ async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<v
|
|||||||
await submitDependencyGraphFile(dependencyGraphFile)
|
await submitDependencyGraphFile(dependencyGraphFile)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof RequestError) {
|
if (error instanceof RequestError) {
|
||||||
throw new Error(translateErrorMessage(dependencyGraphFile, error))
|
error.message = translateErrorMessage(dependencyGraphFile, error)
|
||||||
} else {
|
|
||||||
throw error
|
|
||||||
}
|
}
|
||||||
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function translateErrorMessage(jsonFile: string, error: RequestError): string {
|
function translateErrorMessage(jsonFile: string, error: RequestError): string {
|
||||||
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile)
|
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile)
|
||||||
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${String(error)}`
|
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${error.message}`
|
||||||
if (error.message === 'Resource not accessible by integration') {
|
if (error.message === 'Resource not accessible by integration') {
|
||||||
return `${mainWarning}
|
return `${mainWarning}
|
||||||
Please ensure that the 'contents: write' permission is available for the workflow job.
|
Please ensure that the 'contents: write' permission is available for the workflow job.
|
||||||
|
@ -22,7 +22,10 @@ export function handleMainActionError(error: unknown): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (error instanceof JobFailure) {
|
} else if (error instanceof JobFailure) {
|
||||||
core.setFailed(String(error)) // No stack trace for JobFailure: these are known errors
|
core.setFailed(String(error))
|
||||||
|
if (error.stack) {
|
||||||
|
core.info(error.stack)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
core.setFailed(String(error))
|
core.setFailed(String(error))
|
||||||
if (error instanceof Error && error.stack) {
|
if (error instanceof Error && error.stack) {
|
||||||
@ -34,6 +37,9 @@ export function handleMainActionError(error: unknown): void {
|
|||||||
export function handlePostActionError(error: unknown): void {
|
export function handlePostActionError(error: unknown): void {
|
||||||
if (error instanceof JobFailure) {
|
if (error instanceof JobFailure) {
|
||||||
core.setFailed(String(error))
|
core.setFailed(String(error))
|
||||||
|
if (error.stack) {
|
||||||
|
core.info(error.stack)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`)
|
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`)
|
||||||
if (error instanceof Error && error.stack) {
|
if (error instanceof Error && error.stack) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user