mirror of https://github.com/actions/cache.git
				
				
				
			error handling for stream
This commit is contained in:
		
							parent
							
								
									5ddc028cc8
								
							
						
					
					
						commit
						4967c8e6c5
					
				| 
						 | 
				
			
			@ -2379,11 +2379,15 @@ function uploadFile(httpClient, cacheId, archivePath) {
 | 
			
		|||
                    const start = offset;
 | 
			
		||||
                    const end = offset + chunkSize - 1;
 | 
			
		||||
                    offset += MAX_CHUNK_SIZE;
 | 
			
		||||
                    yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
 | 
			
		||||
                    yield uploadChunk(httpClient, resourceUrl, () => fs
 | 
			
		||||
                        .createReadStream(archivePath, {
 | 
			
		||||
                        fd,
 | 
			
		||||
                        start,
 | 
			
		||||
                        end,
 | 
			
		||||
                        autoClose: false
 | 
			
		||||
                    })
 | 
			
		||||
                        .on("error", error => {
 | 
			
		||||
                        throw new Error(`Cache upload failed because file read failed with ${error.Message}`);
 | 
			
		||||
                    }), start, end);
 | 
			
		||||
                }
 | 
			
		||||
            })));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2379,11 +2379,15 @@ function uploadFile(httpClient, cacheId, archivePath) {
 | 
			
		|||
                    const start = offset;
 | 
			
		||||
                    const end = offset + chunkSize - 1;
 | 
			
		||||
                    offset += MAX_CHUNK_SIZE;
 | 
			
		||||
                    yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
 | 
			
		||||
                    yield uploadChunk(httpClient, resourceUrl, () => fs
 | 
			
		||||
                        .createReadStream(archivePath, {
 | 
			
		||||
                        fd,
 | 
			
		||||
                        start,
 | 
			
		||||
                        end,
 | 
			
		||||
                        autoClose: false
 | 
			
		||||
                    })
 | 
			
		||||
                        .on("error", error => {
 | 
			
		||||
                        throw new Error(`Cache upload failed because file read failed with ${error.Message}`);
 | 
			
		||||
                    }), start, end);
 | 
			
		||||
                }
 | 
			
		||||
            })));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -295,12 +295,18 @@ async function uploadFile(
 | 
			
		|||
                        httpClient,
 | 
			
		||||
                        resourceUrl,
 | 
			
		||||
                        () =>
 | 
			
		||||
                            fs.createReadStream(archivePath, {
 | 
			
		||||
                                fd,
 | 
			
		||||
                                start,
 | 
			
		||||
                                end,
 | 
			
		||||
                                autoClose: false
 | 
			
		||||
                            }),
 | 
			
		||||
                            fs
 | 
			
		||||
                                .createReadStream(archivePath, {
 | 
			
		||||
                                    fd,
 | 
			
		||||
                                    start,
 | 
			
		||||
                                    end,
 | 
			
		||||
                                    autoClose: false
 | 
			
		||||
                                })
 | 
			
		||||
                                .on("error", error => {
 | 
			
		||||
                                    throw new Error(
 | 
			
		||||
                                        `Cache upload failed because file read failed with ${error.Message}`
 | 
			
		||||
                                    );
 | 
			
		||||
                                }),
 | 
			
		||||
                        start,
 | 
			
		||||
                        end
 | 
			
		||||
                    );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue