change internal error to warning

This commit is contained in:
Dmitry Shibanov 2022-03-30 14:34:57 +02:00
parent 62e9de96c2
commit 8a5e1b59e0
5 changed files with 13 additions and 7 deletions

View file

@ -11,6 +11,7 @@ describe('cache-utils', () => {
let getCommandOutputSpy: jest.SpyInstance;
let isFeatureAvailable: jest.SpyInstance;
let info: jest.SpyInstance;
let warningSpy: jest.SpyInstance;
beforeEach(() => {
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
@ -18,6 +19,7 @@ describe('cache-utils', () => {
debugSpy.mockImplementation(msg => {});
info = jest.spyOn(core, 'info');
warningSpy = jest.spyOn(core, 'warning');
isFeatureAvailable = jest.spyOn(cache, 'isFeatureAvailable');
@ -52,8 +54,8 @@ describe('cache-utils', () => {
it('isCacheFeatureAvailable for GHES has an interhal error', () => {
isFeatureAvailable.mockImplementation(() => false);
process.env['GITHUB_SERVER_URL'] = '';
expect(() => isCacheFeatureAvailable()).toThrowError(
isCacheFeatureAvailable();
expect(warningSpy).toHaveBeenCalledWith(
'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'
);
});

View file

@ -686,8 +686,8 @@ describe('setup-node', () => {
await main.run();
expect(cnSpy).toHaveBeenCalledWith(
`::error::An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.${osm.EOL}`
expect(warningSpy).toHaveBeenCalledWith(
'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'
);
});
});

View file

@ -3884,8 +3884,9 @@ function isCacheFeatureAvailable() {
throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
}
else {
throw new Error('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.');
core.warning('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.');
}
return false;
}
return true;
}

3
dist/setup/index.js vendored
View file

@ -46137,8 +46137,9 @@ function isCacheFeatureAvailable() {
throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
}
else {
throw new Error('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.');
core.warning('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.');
}
return false;
}
return true;
}

View file

@ -111,10 +111,12 @@ export function isCacheFeatureAvailable(): boolean {
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
);
} else {
throw new Error(
core.warning(
'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'
);
}
return false;
}
return true;