2023-12-05 17:35:46 +00:00
export class FilesNotFoundError extends Error {
files : string [ ]
constructor ( files : string [ ] = [ ] ) {
let message = 'No files were found to upload'
if ( files . length > 0 ) {
message += ` : ${ files . join ( ', ' ) } `
}
super ( message )
this . files = files
this . name = 'FilesNotFoundError'
}
}
export class InvalidResponseError extends Error {
constructor ( message : string ) {
super ( message )
this . name = 'InvalidResponseError'
}
}
2023-12-05 17:56:18 +00:00
export class ArtifactNotFoundError extends Error {
2023-12-05 18:35:26 +00:00
constructor ( message = 'Artifact not found' ) {
2023-12-05 17:56:18 +00:00
super ( message )
this . name = 'ArtifactNotFoundError'
}
}
2023-12-05 18:42:36 +00:00
2023-12-05 18:47:37 +00:00
export class GHESNotSupportedError extends Error {
2023-12-05 18:42:36 +00:00
constructor (
2023-12-05 21:55:22 +00:00
message = '@actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.'
2023-12-05 18:42:36 +00:00
) {
super ( message )
2023-12-05 18:47:37 +00:00
this . name = 'GHESNotSupportedError'
2023-12-05 18:42:36 +00:00
}
}
2023-12-11 22:07:48 +00:00
export class NetworkError extends Error {
code : string
constructor ( code : string ) {
const message = ` Unable to make request: ${ code } \ nIf you are using self-hosted runners, please make sure your runner has access to all GitHub endpoints: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github `
super ( message )
this . code = code
this . name = 'NetworkError'
}
static isNetworkErrorCode = ( code? : string ) : boolean = > {
if ( ! code ) return false
return [
'ECONNRESET' ,
'ENOTFOUND' ,
'ETIMEDOUT' ,
'ECONNREFUSED' ,
'EHOSTUNREACH'
] . includes ( code )
}
}