Consolidate error processing in actions

This commit is contained in:
daz
2024-04-11 10:18:07 -06:00
parent 1c25312b02
commit ba79f71e36
6 changed files with 42 additions and 52 deletions

View File

@@ -1,5 +1,3 @@
import * as core from '@actions/core'
import * as setupGradle from '../setup-gradle'
import * as gradle from '../execution/gradle'
import * as dependencyGraph from '../dependency-graph'
@@ -12,6 +10,7 @@ import {
setActionId
} from '../configuration'
import {recordDeprecation, saveDeprecationState} from '../deprecation-collector'
import {handleMainActionError} from '../errors'
/**
* The main entry point for the action, called by Github Actions for the step.
@@ -41,10 +40,7 @@ export async function run(): Promise<void> {
saveDeprecationState()
} catch (error) {
core.setFailed(String(error))
if (error instanceof Error && error.stack) {
core.info(error.stack)
}
handleMainActionError(error)
}
// Explicit process.exit() to prevent waiting for hanging promises.