mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 13:29:10 +08:00 
			
		
		
		
	error handling for stream
This commit is contained in:
		@@ -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
 | 
			
		||||
                    );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user