mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-05-01 07:38:04 +08:00
Graceful handling of error (non-validation one) (#1122)
* Initial changes * added info error as well * Format * Unused package * adding message field * removed line * Review comments * review comment to add validation as errors handling
This commit is contained in:
@@ -73,13 +73,17 @@ test('restore with no cache found', async () => {
|
||||
test('restore with server error should fail', async () => {
|
||||
const paths = ['node_modules']
|
||||
const key = 'node-test'
|
||||
const logWarningMock = jest.spyOn(core, 'warning')
|
||||
|
||||
jest.spyOn(cacheHttpClient, 'getCacheEntry').mockImplementation(() => {
|
||||
throw new Error('HTTP Error Occurred')
|
||||
})
|
||||
|
||||
await expect(restoreCache(paths, key)).rejects.toThrowError(
|
||||
'HTTP Error Occurred'
|
||||
const cacheKey = await restoreCache(paths, key)
|
||||
expect(cacheKey).toBe(undefined)
|
||||
expect(logWarningMock).toHaveBeenCalledTimes(1)
|
||||
expect(logWarningMock).toHaveBeenCalledWith(
|
||||
'Failed to restore: HTTP Error Occurred'
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user