mirror of
				https://kkgithub.com/actions/cache.git
				synced 2025-11-04 12:41:50 +08:00 
			
		
		
		
	error handling for stream
This commit is contained in:
		
							
								
								
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							@ -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);
 | 
			
		||||
                }
 | 
			
		||||
            })));
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user