Skip to content
Snippets Groups Projects
Commit 8bfe3897 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix(github): platform-error if ENOTFOUND

parent 4d48ba13
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,9 @@ async function get(path, options, retries = 5) {
}
return res;
} catch (err) {
if (err.name === 'RequestError' && err.code === 'ENOTFOUND') {
throw new Error('platform-failure');
}
if (err.statusCode >= 500 && err.statusCode < 600) {
if (retries > 0) {
logger.info(
......
......@@ -109,6 +109,22 @@ describe('platform/gh-got-wrapper', () => {
expect(e).toBeDefined();
expect(e.message).toEqual('platform-failure');
});
it('should throw platform failure ENOTFOUND', async () => {
ghGot.mockImplementationOnce(() =>
Promise.reject({
name: 'RequestError',
code: 'ENOTFOUND',
})
);
let e;
try {
await get('some-url', {}, 0);
} catch (err) {
e = err;
}
expect(e).toBeDefined();
expect(e.message).toEqual('platform-failure');
});
it('should throw platform failure for 500', async () => {
ghGot.mockImplementationOnce(() =>
Promise.reject({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment