mirror of
https://github.com/gradle/actions.git
synced 2025-12-08 17:15:46 +08:00
Consolidate error processing in actions
This commit is contained in:
@@ -2,6 +2,7 @@ import * as path from 'path'
|
||||
import * as core from '@actions/core'
|
||||
|
||||
import * as validate from './validate'
|
||||
import {handleMainActionError} from '../errors'
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
@@ -22,16 +23,7 @@ export async function run(): Promise<void> {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof AggregateError) {
|
||||
core.setFailed(`Multiple errors returned`)
|
||||
for (const err of error.errors) {
|
||||
core.error(`Error ${error.errors.indexOf(err)}: ${err.message}`)
|
||||
}
|
||||
} else if (error instanceof Error) {
|
||||
core.setFailed(error.message)
|
||||
} else {
|
||||
core.setFailed(`Unknown object was thrown: ${error}`)
|
||||
}
|
||||
handleMainActionError(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user