mirror of https://github.com/actions/toolkit
More error handling
parent
520206f818
commit
990647a104
|
@ -263,12 +263,20 @@ export class DownloadHttpClient {
|
||||||
if (isGzip) {
|
if (isGzip) {
|
||||||
const gunzip = zlib.createGunzip()
|
const gunzip = zlib.createGunzip()
|
||||||
response.message
|
response.message
|
||||||
|
.on('error', error => {
|
||||||
|
core.error(
|
||||||
|
`An error occurred while attempting to read the response stream`
|
||||||
|
)
|
||||||
|
reject(error)
|
||||||
|
gunzip.close()
|
||||||
|
})
|
||||||
.pipe(gunzip)
|
.pipe(gunzip)
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.error(
|
||||||
`An error has been encountered while attempting to decompress a file`
|
`An error occurred while attempting to decompress the response stream`
|
||||||
)
|
)
|
||||||
reject(error)
|
reject(error)
|
||||||
|
destinationStream.close()
|
||||||
})
|
})
|
||||||
.pipe(destinationStream)
|
.pipe(destinationStream)
|
||||||
.on('close', () => {
|
.on('close', () => {
|
||||||
|
@ -276,19 +284,26 @@ export class DownloadHttpClient {
|
||||||
})
|
})
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.error(
|
||||||
`An error has been encountered while decompressing and writing a downloaded file to ${destinationStream.path}`
|
`An error occurred while writing a downloaded file to ${destinationStream.path}`
|
||||||
)
|
)
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
response.message
|
response.message
|
||||||
|
.on('error', error => {
|
||||||
|
core.error(
|
||||||
|
`An error occurred while attempting to read the response stream`
|
||||||
|
)
|
||||||
|
reject(error)
|
||||||
|
destinationStream.close()
|
||||||
|
})
|
||||||
.pipe(destinationStream)
|
.pipe(destinationStream)
|
||||||
.on('close', () => {
|
.on('close', () => {
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.error(
|
||||||
`An error has been encountered while writing a downloaded file to ${destinationStream.path}`
|
`An error occurred while writing a downloaded file to ${destinationStream.path}`
|
||||||
)
|
)
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue